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

16168 lines
469 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.
*
* Anti DDoS Pro Web Rule Configuration APIs
* Anti DDoS Pro Web Rule Configuration APIs
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
require('../../../lib/node_loader')
var JDCloud = require('../../../lib/core')
var Service = JDCloud.Service
var serviceId = 'ipanti'
Service._services[serviceId] = true
/**
* ipanti service.
* @version 1.12.0
*/
class IPANTI extends Service {
constructor (options = {}) {
options._defaultEndpoint = {}
options._defaultEndpoint.protocol =
options._defaultEndpoint.protocol || 'https'
options._defaultEndpoint.host =
options._defaultEndpoint.host || 'ipanti.jdcloud-api.com'
options.basePath = '/v1' // 默认要设为空""
super(serviceId, options)
}
/**
* 查询 DDoS 攻击日志, 仅能查询非BGP实例的攻击记录, 同时查询BGP和非BGP实例请使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeDDoSIpAttackLogs'>describeDDoSIpAttackLogs</a>
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param dDoSAttackLog dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 实例总数
* @param integer totalPage 总页数
*/
describeDDoSAttackLogs (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeDDoSAttackLogs"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeDDoSAttackLogs"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeDDoSAttackLogs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeDDoSAttackLogs',
'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的 DDoS 攻击日志, 仅BGP实例返回的是IP级别的攻击记录, 非BGP实例返回的仍是实例级别的攻击记录(serviceIp 字段为空)
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 查询 ip 相关攻击记录.
- 未指定 serviceIp 时, 查询 instanceId 指定实例相关攻击记录.
- serviceIp 和 instanceId 均未指定时, 查询用户所有攻击记录
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param dDoSIpAttackLog dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 实例总数
* @param integer totalPage 总页数
*/
describeDDoSIpAttackLogs (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeDDoSIpAttackLogs"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeDDoSIpAttackLogs"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeDDoSIpAttackLogs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeDDoSIpAttackLogs',
'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)
}
)
}
/**
* 查询 CC 攻击日志
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCAttackLog dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 实例总数
* @param integer totalPage 总页数
*/
describeCCAttackLogs (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCAttackLogs"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeCCAttackLogs"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCAttackLogs with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeCCAttackLogs',
'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)
}
)
}
/**
* 查询 CC 攻击日志详情.
- 参数 attackId 优先级高于 instanceId, attackId 不为空时, 忽略 instanceId
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} [opts.startTime] - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ, attackId 为空时必传 optional
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} [opts.attackId] - CC 攻击记录 Id, 不为空时忽略 startTime, endTime optional
* @param {string} [opts.subDomain] - 查询的子域名, 只有选中某一个实例后才能多选子域名 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCAttackLogDetail dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 实例总数
* @param integer totalPage 总页数
*/
describeCCAttackLogDetails (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCAttackLogDetails"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
if (opts.instanceId !== undefined && opts.instanceId !== null) {
queryParams['instanceId'] = opts.instanceId
}
if (opts.attackId !== undefined && opts.attackId !== null) {
queryParams['attackId'] = opts.attackId
}
Object.assign(
queryParams,
super.buildArrayParam(opts.subDomain, 'subDomain')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCAttackLogDetails with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeCCAttackLogDetails',
'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)
}
)
}
/**
* 查询攻击次数及流量峰值
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 统计 ip 相关攻击
- 未指定 serviceIp 时, 统计 instanceId 指定实例相关攻击
- serviceIp 和 instanceId 均未指定时, 统计用户所有攻击记录
CC攻击为实例级别, 查询类型 type 为 cc 时, 参数 serviceIp 无效
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {integer} opts.type - 攻击类型, 0 为 DDoS, 1 为 CC
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param number flow 攻击流量峰值
* @param integer count 攻击次数
* @param string unit 流量单位, bps、Kbps、Mbps、Gbps
*/
describeAttackStatistics (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeAttackStatistics"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeAttackStatistics"
)
}
if (opts.type === undefined || opts.type === null) {
throw new Error(
"Missing the required parameter 'opts.type' when calling describeAttackStatistics"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
if (opts.type !== undefined && opts.type !== null) {
queryParams['type'] = opts.type
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeAttackStatistics with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeAttackStatistics',
'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)
}
)
}
/**
* 查询各类型攻击次数
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 统计 ip 相关攻击
- 未指定 serviceIp 时, 统计 instanceId 指定实例相关攻击
- serviceIp 和 instanceId 均未指定时, 统计用户所有攻击记录
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 ID optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param attackTypeCount dataList
*/
describeAttackTypeCount (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeAttackTypeCount"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeAttackTypeCount"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeAttackTypeCount with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/attacklog:describeAttackTypeCount',
'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)
}
)
}
/**
* DDos 防护流量报表
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 查询 ip 相关报表
- 未指定 serviceIp 时, 查询 instanceId 指定实例相关报表
- serviceIp 和 instanceId 均未指定时, 查询用户所有实例报表
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param number preProtect
* @param number postProtect
* @param string time
* @param string unit 流量单位, bps, Kbps, Mbps, Gbps
*/
describeDDoSGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeDDoSGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeDDoSGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeDDoSGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:DDoSGraph',
'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.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param number forwardRecord
* @param string time
* @param string unit 流量单位, bps, Kbps, Mbps, Gbps
*/
describeFwdGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeFwdGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeFwdGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeFwdGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:fwdGraph',
'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)
}
)
}
/**
* 业务流量报表
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 查询 ip 相关报表
- 未指定 serviceIp 时, 查询 instanceId 指定实例相关报表
- serviceIp 和 instanceId 均未指定时, 查询用户所有实例报表
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param number inTraffic
* @param number outTraffic
* @param string time
* @param string unit 流量单位, bps, Kbps, Mbps, Gbps
*/
describeBusinessGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeBusinessGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeBusinessGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeBusinessGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:businessGraph',
'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)
}
)
}
/**
* CC 防护流量报表
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} [opts.subDomain] - 规则域名列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer postProtect
* @param integer preProtect
* @param string time
* @param string unit 流量单位
*/
describeCCGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeCCGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.subDomain, 'subDomain')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:CCGraph',
'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.startTime - 开始时间, 只能查询最近 7 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} [opts.subDomain] - 规则域名列表 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer status500
* @param integer status502
* @param integer status504
* @param integer status590
* @param integer status592
* @param integer status594
* @param integer status5xx
* @param string time
*/
describeStatusGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeStatusGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeStatusGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.subDomain, 'subDomain')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeStatusGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:statusGraph',
'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)
}
)
}
/**
* 新建与并发连接数统计报表
参数 serviceIp 优先级大于 instanceId.
- 指定 serviceIp 参数时, 忽略 instanceId 参数, 查询 ip 相关报表
- 未指定 serviceIp 时, 查询 instanceId 指定实例相关报表
- serviceIp 和 instanceId 均未指定时, 查询用户所有实例报表
* @param {Object} opts - parameters
* @param {string} opts.startTime - 开始时间, 只能查询最近 90 天以内的数据, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ
* @param {string} [opts.endTime] - 查询的结束时间, UTC 时间, 格式: yyyy-MM-dd'T'HH:mm:ssZ optional
* @param {string} [opts.instanceId] - 高防实例 Id 列表 optional
* @param {string} [opts.serviceIp] - 高防IP列表. <br>- 使用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/describeServiceIpList'>describeServiceIpList</a> 接口查询实例的高防 IP optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer newConn
* @param integer activeConn
* @param integer inactiveConn
* @param string time
*/
describeConnStatGraph (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeConnStatGraph"
)
}
opts = opts || {}
if (opts.startTime === undefined || opts.startTime === null) {
throw new Error(
"Missing the required parameter 'opts.startTime' when calling describeConnStatGraph"
)
}
let postBody = null
let queryParams = {}
if (opts.startTime !== undefined && opts.startTime !== null) {
queryParams['startTime'] = opts.startTime
}
if (opts.endTime !== undefined && opts.endTime !== null) {
queryParams['endTime'] = opts.endTime
}
Object.assign(
queryParams,
super.buildArrayParam(opts.instanceId, 'instanceId')
)
Object.assign(
queryParams,
super.buildArrayParam(opts.serviceIp, 'serviceIp')
)
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeConnStatGraph with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/charts:connStatGraph',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询某个实例下的防护调度规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} [opts.name] - 实例名称, 可模糊匹配 optional
* @param {string} [opts.innerIp] - 云内IP, 可模糊匹配 optional
* @param {string} [opts.serviceIp] - 高防IP, 可模糊匹配 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param dispatchRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeDispatchRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeDispatchRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeDispatchRules"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.innerIp !== undefined && opts.innerIp !== null) {
queryParams['innerIp'] = opts.innerIp
}
if (opts.serviceIp !== undefined && opts.serviceIp !== null) {
queryParams['serviceIp'] = opts.serviceIp
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeDispatchRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加防护调度规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {createDispatchRuleSpec} opts.createDispatchRuleSpec - 添加防护调度规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加规则失败, 1: 添加规则成功
* @param string message 添加规则失败时给出具体原因
*/
createDispatchRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createDispatchRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createDispatchRule"
)
}
if (
opts.createDispatchRuleSpec === undefined ||
opts.createDispatchRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.createDispatchRuleSpec' when calling createDispatchRule"
)
}
let postBody = {}
if (
opts.createDispatchRuleSpec !== undefined &&
opts.createDispatchRuleSpec !== null
) {
postBody['createDispatchRuleSpec'] = opts.createDispatchRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createDispatchRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 批量添加防护调度规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {array} opts.dispatchRuleSpecList - 批量添加防护调度规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string dispatchRuleIds
* @param failedRule failRules
*/
createDispatchRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createDispatchRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createDispatchRules"
)
}
if (
opts.dispatchRuleSpecList === undefined ||
opts.dispatchRuleSpecList === null
) {
throw new Error(
"Missing the required parameter 'opts.dispatchRuleSpecList' when calling createDispatchRules"
)
}
let postBody = {}
if (
opts.dispatchRuleSpecList !== undefined &&
opts.dispatchRuleSpecList !== null
) {
postBody['dispatchRuleSpecList'] = opts.dispatchRuleSpecList
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createDispatchRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:createDispatchRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 更新防护调度规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.dispatchRuleId - 防护调度规则 Id
* @param {modifyDispatchRuleSpec} opts.modifyDispatchRuleSpec - 更新防护调度规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 更新规则失败, 1: 更新规则成功
* @param string message 更新规则失败时给出具体原因
*/
modifyDispatchRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyDispatchRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyDispatchRule"
)
}
if (opts.dispatchRuleId === undefined || opts.dispatchRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.dispatchRuleId' when calling modifyDispatchRule"
)
}
if (
opts.modifyDispatchRuleSpec === undefined ||
opts.modifyDispatchRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.modifyDispatchRuleSpec' when calling modifyDispatchRule"
)
}
let postBody = {}
if (
opts.modifyDispatchRuleSpec !== undefined &&
opts.modifyDispatchRuleSpec !== null
) {
postBody['modifyDispatchRuleSpec'] = opts.modifyDispatchRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
dispatchRuleId: opts.dispatchRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyDispatchRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules/{dispatchRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除防护调度规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.dispatchRuleId - 防护调度规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 删除规则失败, 1: 删除规则成功
* @param string message 删除规则失败时给出具体原因
*/
deleteDispatchRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteDispatchRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteDispatchRule"
)
}
if (opts.dispatchRuleId === undefined || opts.dispatchRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.dispatchRuleId' when calling deleteDispatchRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
dispatchRuleId: opts.dispatchRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteDispatchRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules/{dispatchRuleId}',
'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.instanceId - 高防实例 Id
* @param {string} opts.dispatchRuleId - 防护调度规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 规则切换成防御失败, 1: 规则切换成防御成功
* @param string message 规则切换成防御失败时给出具体原因
*/
switchDispatchRuleProtect (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchDispatchRuleProtect"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchDispatchRuleProtect"
)
}
if (opts.dispatchRuleId === undefined || opts.dispatchRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.dispatchRuleId' when calling switchDispatchRuleProtect"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
dispatchRuleId: opts.dispatchRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchDispatchRuleProtect with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules/{dispatchRuleId}:protect',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 防护调度规则切换成回源状态
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.dispatchRuleId - 防护调度规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 规则切换成回源失败, 1: 规则切换成回源成功
* @param string message 规则切换成回源失败时给出具体原因
*/
switchDispatchRuleOrigin (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchDispatchRuleOrigin"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchDispatchRuleOrigin"
)
}
if (opts.dispatchRuleId === undefined || opts.dispatchRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.dispatchRuleId' when calling switchDispatchRuleOrigin"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
dispatchRuleId: opts.dispatchRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchDispatchRuleOrigin with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/dispatchRules/{dispatchRuleId}:origin',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询某个实例下的非网站转发配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} [opts.searchType] - 查询类型名称, domain:源站域名, ip:源站 IP, port: 转发端口, originPort: 源站端口, serviceIp: 高防IP(仅支持BGP线路的实例) optional
* @param {string} [opts.searchValue] - 查询类型值 optional
* @param {sort} [opts.sorts] - 排序属性:
port - 按转发端口排序,默认不排序,asc表示按转发端口升序,desc表示按转发端口降序
optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param forwardRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeForwardRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeForwardRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeForwardRules"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.searchType !== undefined && opts.searchType !== null) {
queryParams['searchType'] = opts.searchType
}
if (opts.searchValue !== undefined && opts.searchValue !== null) {
queryParams['searchValue'] = opts.searchValue
}
Object.assign(queryParams, super.buildSortParam(opts.sorts, 'sorts'))
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeForwardRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加非网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {forwardRuleSpec} opts.forwardRuleSpec - 添加非网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加规则失败, 1: 添加规则成功
* @param string message 添加规则失败时给出具体原因
*/
createForwardRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createForwardRule"
)
}
if (opts.forwardRuleSpec === undefined || opts.forwardRuleSpec === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleSpec' when calling createForwardRule"
)
}
let postBody = {}
if (opts.forwardRuleSpec !== undefined && opts.forwardRuleSpec !== null) {
postBody['forwardRuleSpec'] = opts.forwardRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 批量添加非网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {array} opts.forwardRuleSpecList - 批量添加非网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string forwardRuleIds
* @param failedPort failedPorts
*/
createForwardRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createForwardRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createForwardRules"
)
}
if (
opts.forwardRuleSpecList === undefined ||
opts.forwardRuleSpecList === null
) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleSpecList' when calling createForwardRules"
)
}
let postBody = {}
if (
opts.forwardRuleSpecList !== undefined &&
opts.forwardRuleSpecList !== null
) {
postBody['forwardRuleSpecList'] = opts.forwardRuleSpecList
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createForwardRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:createForwardRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询非网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param forwardRule data
*/
describeForwardRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling describeForwardRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 更新非网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {forwardRuleSpec} opts.forwardRuleSpec - 更新非网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 更新规则失败, 1: 更新规则成功
* @param string message 更新规则失败时给出具体原因
*/
modifyForwardRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling modifyForwardRule"
)
}
if (opts.forwardRuleSpec === undefined || opts.forwardRuleSpec === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleSpec' when calling modifyForwardRule"
)
}
let postBody = {}
if (opts.forwardRuleSpec !== undefined && opts.forwardRuleSpec !== null) {
postBody['forwardRuleSpec'] = opts.forwardRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除非网站规则, 批量操作时, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 删除规则失败, 1: 删除规则成功
* @param string message 删除规则失败时给出具体原因
*/
deleteForwardRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling deleteForwardRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}',
'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)
}
)
}
/**
* 非网站类规则切换成防御状态。支持批量操作, 批量操作时 forwardRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 切换失败, 1: 切换成功
* @param string message 切换失败时给出具体原因
*/
switchForwardRuleProtect (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchForwardRuleProtect"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchForwardRuleProtect"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling switchForwardRuleProtect"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchForwardRuleProtect with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:protect',
'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)
}
)
}
/**
* 非网站类规则切换成回源状态。支持批量操作, 批量操作时 forwardRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 切换失败, 1: 切换成功
* @param string message 切换失败时给出具体原因
*/
switchForwardRuleOrigin (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchForwardRuleOrigin"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchForwardRuleOrigin"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling switchForwardRuleOrigin"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchForwardRuleOrigin with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:origin',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询非网站类转发规则的防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param forwardProtectionRule protectionRule
*/
describeProtectionRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeProtectionRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeProtectionRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling describeProtectionRuleOfForwardRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeProtectionRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:describeProtectionRule',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改非网站类转发规则的防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {forwardProtectionRuleSpec} opts.forwardProtectionRuleSpec - 修改非网站类转发规则的防护规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改规则失败, 1: 修改规则成功
* @param string message 修改规则失败时给出具体原因
*/
modifyProtectionRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyProtectionRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyProtectionRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling modifyProtectionRuleOfForwardRule"
)
}
if (
opts.forwardProtectionRuleSpec === undefined ||
opts.forwardProtectionRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.forwardProtectionRuleSpec' when calling modifyProtectionRuleOfForwardRule"
)
}
let postBody = {}
if (
opts.forwardProtectionRuleSpec !== undefined &&
opts.forwardProtectionRuleSpec !== null
) {
postBody['forwardProtectionRuleSpec'] = opts.forwardProtectionRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyProtectionRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:modifyProtectionRule',
'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)
}
)
}
/**
* 查询非网站类转发规则的防护规则 Geo 拦截可设置区域编码
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param country dataList
*/
describeGeoAreas (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeGeoAreas"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeGeoAreas with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeGeoAreas',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询转发规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param forwardBlackListRule data
*/
describeBlackListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeBlackListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeBlackListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling describeBlackListRuleOfForwardRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeBlackListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}/forwardBlackListRule',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改转发规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {modifyBlackListRuleOfForwardRuleSpec} opts.modifySpec - 修改转发规则的黑名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 修改结果, 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyBlackListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyBlackListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyBlackListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling modifyBlackListRuleOfForwardRule"
)
}
if (opts.modifySpec === undefined || opts.modifySpec === null) {
throw new Error(
"Missing the required parameter 'opts.modifySpec' when calling modifyBlackListRuleOfForwardRule"
)
}
let postBody = {}
if (opts.modifySpec !== undefined && opts.modifySpec !== null) {
postBody['modifySpec'] = opts.modifySpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyBlackListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}/forwardBlackListRule',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 开启转发规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableBlackListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableBlackListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableBlackListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling enableBlackListRuleOfForwardRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableBlackListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:enableBlackListRuleOfForwardRule',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 关闭转发规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableBlackListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableBlackListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableBlackListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling disableBlackListRuleOfForwardRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableBlackListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:disableBlackListRuleOfForwardRule',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询转发规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param forwardWhiteListRule data
*/
describeWhiteListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWhiteListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWhiteListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling describeWhiteListRuleOfForwardRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWhiteListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}/forwardWhiteListRule',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改转发规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {modifyWhiteListRuleOfForwardRuleSpec} opts.modifySpec - 修改转发规则的黑名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 修改结果, 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyWhiteListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyWhiteListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyWhiteListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling modifyWhiteListRuleOfForwardRule"
)
}
if (opts.modifySpec === undefined || opts.modifySpec === null) {
throw new Error(
"Missing the required parameter 'opts.modifySpec' when calling modifyWhiteListRuleOfForwardRule"
)
}
let postBody = {}
if (opts.modifySpec !== undefined && opts.modifySpec !== null) {
postBody['modifySpec'] = opts.modifySpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyWhiteListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}/forwardWhiteListRule',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 开启转发规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableWhiteListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWhiteListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWhiteListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling enableWhiteListRuleOfForwardRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWhiteListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:enableWhiteListRuleOfForwardRule',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 关闭转发规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.forwardRuleId - 转发规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWhiteListRuleOfForwardRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWhiteListRuleOfForwardRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWhiteListRuleOfForwardRule"
)
}
if (opts.forwardRuleId === undefined || opts.forwardRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.forwardRuleId' when calling disableWhiteListRuleOfForwardRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
forwardRuleId: opts.forwardRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWhiteListRuleOfForwardRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/forwardRules/{forwardRuleId}:disableWhiteListRuleOfForwardRule',
'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黑白名单和geo拦截配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instanceAcl data
*/
describeInstanceAcl (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeInstanceAcl"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstanceAcl"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeInstanceAcl with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:describeInstanceAcl',
'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黑白名单和geo拦截配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {instanceAclSpec} opts.instanceAclSpec - 修改实例全局访问控制配置参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 修改是否下发成功
* @param boolean canRecover 是否可以恢复到上一次的配置
*/
modifyInstanceAcl (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyInstanceAcl"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceAcl"
)
}
if (opts.instanceAclSpec === undefined || opts.instanceAclSpec === null) {
throw new Error(
"Missing the required parameter 'opts.instanceAclSpec' when calling modifyInstanceAcl"
)
}
let postBody = {}
if (opts.instanceAclSpec !== undefined && opts.instanceAclSpec !== null) {
postBody['instanceAclSpec'] = opts.instanceAclSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyInstanceAcl with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:modifyInstanceAcl',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 实例全局访问控制配置可以恢复到上一次下发成功的配置时,调用此接口回滚到上一次下发成功的配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param boolean success 是否回滚成功
*/
recoverInstanceAcl (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling recoverInstanceAcl"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling recoverInstanceAcl"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 recoverInstanceAcl with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:recoverInstanceAcl',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询自定义页面列表
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} [opts.status] - 自定义页面状态, 可取值approving: 审批中, refused: 审批不通过, approved: 审批通过, 为空时查询全部 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param customPage dataList
*/
describeCustomPages (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCustomPages"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeCustomPages"
)
}
let postBody = null
let queryParams = {}
if (opts.status !== undefined && opts.status !== null) {
queryParams['status'] = opts.status
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCustomPages with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/customPages',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加自定义页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {customPageSpec} opts.customPageSpec - 添加自定义页面请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createCustomPage"
)
}
if (opts.customPageSpec === undefined || opts.customPageSpec === null) {
throw new Error(
"Missing the required parameter 'opts.customPageSpec' when calling createCustomPage"
)
}
let postBody = {}
if (opts.customPageSpec !== undefined && opts.customPageSpec !== null) {
postBody['customPageSpec'] = opts.customPageSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/customPages',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改自定义页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} opts.pageId - 自定义页面Id
* @param {customPageSpec} opts.customPageSpec - 修改自定义页面请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyCustomPage"
)
}
if (opts.pageId === undefined || opts.pageId === null) {
throw new Error(
"Missing the required parameter 'opts.pageId' when calling modifyCustomPage"
)
}
if (opts.customPageSpec === undefined || opts.customPageSpec === null) {
throw new Error(
"Missing the required parameter 'opts.customPageSpec' when calling modifyCustomPage"
)
}
let postBody = {}
if (opts.customPageSpec !== undefined && opts.customPageSpec !== null) {
postBody['customPageSpec'] = opts.customPageSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
pageId: opts.pageId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/customPages/{pageId}',
'PUT',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除自定义页面, 使用中的不允许删除
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} opts.pageId - 自定义页面Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteCustomPage"
)
}
if (opts.pageId === undefined || opts.pageId === null) {
throw new Error(
"Missing the required parameter 'opts.pageId' when calling deleteCustomPage"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
pageId: opts.pageId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/customPages/{pageId}',
'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.instanceId - 实例 ID
* @param {string} opts.pageId - 自定义页面Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyInstanceCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyInstanceCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceCustomPage"
)
}
if (opts.pageId === undefined || opts.pageId === null) {
throw new Error(
"Missing the required parameter 'opts.pageId' when calling modifyInstanceCustomPage"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
pageId: opts.pageId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyInstanceCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/customPages/{pageId}:modifyInstanceCustomPage',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改实例页面错误状态码返回页面为为默认页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyInstanceCustomPageDefault (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyInstanceCustomPageDefault"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceCustomPageDefault"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyInstanceCustomPageDefault with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:modifyInstanceCustomPageDefault',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 开启实例错误状态码返回页面, 错误状态码返回默认页面或自定义页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
enableInstanceCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableInstanceCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableInstanceCustomPage"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableInstanceCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:enableInstanceCustomPage',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 关闭实例错误状态码返回页面, 透传错误状态码
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
disableInstanceCustomPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableInstanceCustomPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableInstanceCustomPage"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableInstanceCustomPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:disableInstanceCustomPage',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询实例列表
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围[10, 100], 0 表示全量 optional
* @param {string} [opts.name] - 实例名称, 可模糊匹配 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instance dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeInstances (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeInstances"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call describeInstances with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 新购或升级高防实例
* @param {Object} opts - parameters
* @param {createInstanceSpec} opts.createInstanceSpec - 新购或升级实例请求参数
* @param {autoRenewalSpec} [opts.autoRenewalSpec] - 自动续费配置, 默认不开通, 仅新购实例时可设置 optional
* @param {boolean} [opts.autoPay] - 自动支付标识 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 新购或升级实例失败, 1: 新购或升级实例成功
* @param string message 新购或升级成功时为计费资源ID, 创建实例失败时给出具体原因
* @param string orderNumber 新购或升级实例成功, 且设置了自动支付时, 为订单号。否则为空
*/
createInstance (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createInstance"
)
}
opts = opts || {}
if (
opts.createInstanceSpec === undefined ||
opts.createInstanceSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.createInstanceSpec' when calling createInstance"
)
}
let postBody = {}
if (
opts.createInstanceSpec !== undefined &&
opts.createInstanceSpec !== null
) {
postBody['createInstanceSpec'] = opts.createInstanceSpec
}
if (opts.autoRenewalSpec !== undefined && opts.autoRenewalSpec !== null) {
postBody['autoRenewalSpec'] = opts.autoRenewalSpec
}
if (opts.autoPay !== undefined && opts.autoPay !== null) {
postBody['autoPay'] = opts.autoPay
}
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call createInstance with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询实例
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instance data
*/
describeInstance (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeInstance"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeInstance"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.0'
}
let contentTypes = ['application/json']
let accepts = ['application/json']
// 扩展自定义头
if (opts['x-extra-header']) {
for (let extraHeader in opts['x-extra-header']) {
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
}
if (Array.isArray(opts['x-extra-header']['content-type'])) {
contentTypes = opts['x-extra-header']['content-type']
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
contentTypes = opts['x-extra-header']['content-type'].split(',')
}
if (Array.isArray(opts['x-extra-header']['accept'])) {
accepts = opts['x-extra-header']['accept']
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
accepts = opts['x-extra-header']['accept'].split(',')
}
}
let formParams = {}
let returnType = null
this.config.logger(
`call describeInstance with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改实例名称
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {renameInstanceSpec} opts.renameInstanceSpec - 修改实例名称请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改实例名称失败, 1: 修改实例名称成功
* @param string message 修改失败时给出具体原因
*/
modifyInstanceName (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyInstanceName"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyInstanceName"
)
}
if (
opts.renameInstanceSpec === undefined ||
opts.renameInstanceSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.renameInstanceSpec' when calling modifyInstanceName"
)
}
let postBody = {}
if (
opts.renameInstanceSpec !== undefined &&
opts.renameInstanceSpec !== null
) {
postBody['renameInstanceSpec'] = opts.renameInstanceSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyInstanceName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:rename',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 更新实例弹性防护带宽
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {modifyInstanceEPBSpec} opts.modifyInstanceEPBSpec - 修改实例名称请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyEPB (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyEPB"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyEPB"
)
}
if (
opts.modifyInstanceEPBSpec === undefined ||
opts.modifyInstanceEPBSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.modifyInstanceEPBSpec' when calling modifyEPB"
)
}
let postBody = {}
if (
opts.modifyInstanceEPBSpec !== undefined &&
opts.modifyInstanceEPBSpec !== null
) {
postBody['modifyInstanceEPBSpec'] = opts.modifyInstanceEPBSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyEPB with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:modifyEPB',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询告警配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param alarmConfig data
*/
describeAlarmConfig (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeAlarmConfig"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeAlarmConfig"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeAlarmConfig with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:describeAlarmConfig',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 更新告警配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 实例 ID
* @param {alarmConfigSpec} opts.alarmConfigSpec - 更新告警配置请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyAlarmConfig (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyAlarmConfig"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyAlarmConfig"
)
}
if (opts.alarmConfigSpec === undefined || opts.alarmConfigSpec === null) {
throw new Error(
"Missing the required parameter 'opts.alarmConfigSpec' when calling modifyAlarmConfig"
)
}
let postBody = {}
if (opts.alarmConfigSpec !== undefined && opts.alarmConfigSpec !== null) {
postBody['alarmConfigSpec'] = opts.alarmConfigSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyAlarmConfig with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:modifyAlarmConfig',
'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.instanceId - 实例 ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string data
*/
describeOriginWhiteIpList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeOriginWhiteIpList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeOriginWhiteIpList"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeOriginWhiteIpList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:describeOriginWhiteIpList',
'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.instanceId - 实例 ID
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围[10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param serviceIp dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeServiceIpList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeServiceIpList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeServiceIpList"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeServiceIpList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:describeServiceIpList',
'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查询对应的实例Id, 调用 <a href='http://docs.jdcloud.com/anti-ddos-pro/api/createInstance'>createInstance</a> 接口成功后,跟据message字段返回的计费资源Id查询对应的高防实例ID, 需要高防实例实际创建成功以后才可查询得到
* @param {Object} opts - parameters
* @param {string} opts.resourceId - 高防实例计费资源ID
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instanceIdVo data
*/
describeInstanceIdByResourceId (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeInstanceIdByResourceId"
)
}
opts = opts || {}
if (opts.resourceId === undefined || opts.resourceId === null) {
throw new Error(
"Missing the required parameter 'opts.resourceId' when calling describeInstanceIdByResourceId"
)
}
let postBody = null
let queryParams = {}
if (opts.resourceId !== undefined && opts.resourceId !== null) {
queryParams['resourceId'] = opts.resourceId
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeInstanceIdByResourceId with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeInstanceIdByResourceId',
'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, 为空则查询所有实例名称 optional
* @param {string} [opts.name] - 实例名称, 可模糊匹配 optional
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围 [10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param instanceIdName dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeNameList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeNameList"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.id !== undefined && opts.id !== null) {
queryParams['id'] = opts.id
}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeNameList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeNameList',
'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 protectionStatistics data
*/
describeProtectionStatistics (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeProtectionStatistics"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeProtectionStatistics with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeProtectionStatistics',
'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 protectionOutline data
*/
describeProtectionOutline (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeProtectionOutline"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeProtectionOutline with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeProtectionOutline',
'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 - 待检测实例名称
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 检测结果 code, 0: 不可用, 1: 可用
* @param string message 检测结果, 不可用时给出具体原因
*/
checkName (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling checkName"
)
}
opts = opts || {}
if (opts.name === undefined || opts.name === null) {
throw new Error(
"Missing the required parameter 'opts.name' when calling checkName"
)
}
let postBody = null
let queryParams = {}
if (opts.name !== undefined && opts.name !== null) {
queryParams['name'] = opts.name
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 checkName with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/checkName',
'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 的京东云云内弹性公网 IP 资源
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围 [0, 100], 0 表示全量 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param vpcIpResource dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeVpcIpList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeVpcIpList"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeVpcIpList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeVpcIpList',
'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 的京东云云物理服务器公网 IP 资源
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围 [0, 100], 0 表示全量 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cpsIpResource dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeCpsIpList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCpsIpList"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCpsIpList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/cpsIpResources',
'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 的京东云托管区公网 IP 资源
* @param {Object} opts - parameters
* @param {integer} [opts.pageNumber] - 页码, 默认为 1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为 10, 取值范围 [0, 100], 0 表示全量 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ccsIpResource dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeCcsIpList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCcsIpList"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCcsIpList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/ccsIpResources',
'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.instanceId - 高防实例 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipSet dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeIpSets (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeIpSets"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeIpSets"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeIpSets with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/ipSets',
'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 黑白名单, 预定义的 IP 黑白名单绑定到转发规则的黑名单或白名单后生效
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {ipSetSpec} opts.ipSetSpec - 添加实例的 IP 黑白名单请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createIpSet (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createIpSet"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createIpSet"
)
}
if (opts.ipSetSpec === undefined || opts.ipSetSpec === null) {
throw new Error(
"Missing the required parameter 'opts.ipSetSpec' when calling createIpSet"
)
}
let postBody = {}
if (opts.ipSetSpec !== undefined && opts.ipSetSpec !== null) {
postBody['ipSetSpec'] = opts.ipSetSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createIpSet with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/ipSets',
'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.instanceId - 高防实例 Id
* @param {string} opts.ipSetId - IP 黑白名单 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param ipSet data
*/
describeIpSet (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeIpSet"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeIpSet"
)
}
if (opts.ipSetId === undefined || opts.ipSetId === null) {
throw new Error(
"Missing the required parameter 'opts.ipSetId' when calling describeIpSet"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
ipSetId: opts.ipSetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeIpSet with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/ipSets/{ipSetId}',
'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 黑白名单. 支持批量操作, 批量操作时 ipSetId 传多个, 以 ',' 分隔. IP 黑白名单规则被引用时不允许删除
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.ipSetId - IP 黑白名单 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param batchResultDetail data
*/
deleteIpSet (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteIpSet"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteIpSet"
)
}
if (opts.ipSetId === undefined || opts.ipSetId === null) {
throw new Error(
"Missing the required parameter 'opts.ipSetId' when calling deleteIpSet"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
ipSetId: opts.ipSetId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteIpSet with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/ipSets/{ipSetId}',
'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.instanceId - 高防实例 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer allocatedNum 实例已添加的 IP 黑白名单数量
* @param integer surplusAllocateNum 实例还可添加的 IP 黑白名单数量
* @param integer maxAllocateNum 实例最多可添加的 IP 黑白名单数量
*/
describeIpSetUsage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeIpSetUsage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeIpSetUsage"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeIpSetUsage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:describeIpSetUsage',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询某个实例下的网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} [opts.searchType] - 查询类型名称, domain:源站域名, ip:源站 IP, rawDomain: 域名, serviceIp: 高防IP(仅支持BGP线路的实例) optional
* @param {string} [opts.searchValue] - 查询类型值 optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeWebRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWebRules"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
if (opts.searchType !== undefined && opts.searchType !== null) {
queryParams['searchType'] = opts.searchType
}
if (opts.searchValue !== undefined && opts.searchValue !== null) {
queryParams['searchValue'] = opts.searchValue
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {webRuleSpec} opts.webRuleSpec - 添加网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createWebRule"
)
}
if (opts.webRuleSpec === undefined || opts.webRuleSpec === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleSpec' when calling createWebRule"
)
}
let postBody = {}
if (opts.webRuleSpec !== undefined && opts.webRuleSpec !== null) {
postBody['webRuleSpec'] = opts.webRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 批量添加网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {array} opts.webRuleSpecList - 批量添加网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param string webRuleIdIds
* @param failedDomain failedDomains
*/
createWebRules (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createWebRules"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createWebRules"
)
}
if (opts.webRuleSpecList === undefined || opts.webRuleSpecList === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleSpecList' when calling createWebRules"
)
}
let postBody = {}
if (opts.webRuleSpecList !== undefined && opts.webRuleSpecList !== null) {
postBody['webRuleSpecList'] = opts.webRuleSpecList
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createWebRules with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}:createWebRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webRule data
*/
describeWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改网站类规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {webRuleSpec} opts.webRuleSpec - 更新网站类规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 修改网站类规则结果, 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyWebRule"
)
}
if (opts.webRuleSpec === undefined || opts.webRuleSpec === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleSpec' when calling modifyWebRule"
)
}
let postBody = {}
if (opts.webRuleSpec !== undefined && opts.webRuleSpec !== null) {
postBody['webRuleSpec'] = opts.webRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除网站规则。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 删除网站类规则结果, 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling deleteWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}',
'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)
}
)
}
/**
* 网站类规则绑定 SSL 证书
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.certId - 证书 Id. 使用 <a href='https://docs.jdcloud.com/cn/ssl-certificate/api/describecerts'>describeCerts</a> 接口, 按照域名检索可绑定的证书, 域名不匹配将导致证书配置失败
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 绑定失败, 1: 绑定成功
* @param string message 绑定失败时给出具体原因
*/
bindCert (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling bindCert"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling bindCert"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling bindCert"
)
}
if (opts.certId === undefined || opts.certId === null) {
throw new Error(
"Missing the required parameter 'opts.certId' when calling bindCert"
)
}
let postBody = {}
if (opts.certId !== undefined && opts.certId !== null) {
postBody['certId'] = opts.certId
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 bindCert with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:bindCert',
'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)
}
)
}
/**
* 网站类规则切换成防御状态。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 规则切换成防御失败, 1: 规则切换成防御成功
* @param string message 规则切换成防御失败时给出具体原因
*/
switchWebRuleProtect (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchWebRuleProtect"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchWebRuleProtect"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling switchWebRuleProtect"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchWebRuleProtect with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:protect',
'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)
}
)
}
/**
* 网站类规则切换成回源状态。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 规则切换成回源失败, 1: 规则切换成回源成功
* @param string message 规则切换成回源失败时给出具体原因
*/
switchWebRuleOrigin (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling switchWebRuleOrigin"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling switchWebRuleOrigin"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling switchWebRuleOrigin"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 switchWebRuleOrigin with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:origin',
'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)
}
)
}
/**
* 网站类规则开启 CC 防护, 开启后网站类规则已配置的防护规则和 CC 防护配置生效, 若没有配置过 CC 防护, 默认的 CC 防护配置生效。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 开启 CC 失败, 1: 开启 CC 成功
* @param string message 开启 CC 失败时给出具体原因
*/
enableWebRuleCC (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleCC"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleCC"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleCC"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleCC with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableCC',
'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)
}
)
}
/**
* 关闭网站类规则 CC 防护, 网站类规则的 CC 防护规则和 CC 防护配置失效。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 禁用 CC 失败, 1: 禁用 CC 成功
* @param string message 禁用 CC 失败时给出具体原因
*/
disableWebRuleCC (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleCC"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleCC"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleCC"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleCC with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableCC',
'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)
}
)
}
/**
* 开启网站类规则 CC 观察者模式, 观察模式下, CC 防护只告警不防御。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 开启 CC 观察者模式失败, 1: 开启 CC 观察者模式成功
* @param string message 开启 CC 观察者模式失败时给出具体原因
*/
enableWebRuleCCObserverMode (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleCCObserverMode"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleCCObserverMode"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleCCObserverMode"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleCCObserverMode with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableCCObserverMode',
'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)
}
)
}
/**
* 关闭网站类规则 CC 观察者模式, 观察模式下, CC 防护只告警不防御。支持批量操作, 批量操作时 webRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 关闭 CC 观察者模式失败, 1: 关闭 CC 观察者模式成功
* @param string message 关闭 CC 观察者模式失败时给出具体原因
*/
disableWebRuleCCObserverMode (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleCCObserverMode"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleCCObserverMode"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleCCObserverMode"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleCCObserverMode with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableCCObserverMode',
'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)
}
)
}
/**
* 查询网站类规则允许插入JS指纹的页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param jsPage dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeJsPagesOfWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeJsPagesOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeJsPagesOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeJsPagesOfWebRule"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeJsPagesOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/jsPages',
'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)
}
)
}
/**
* 添加网站类规则允许插入JS指纹的页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {jsPageSpec} opts.jsPageSpec - 添加 JS 指纹页面请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createJsPageOfWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createJsPageOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createJsPageOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling createJsPageOfWebRule"
)
}
if (opts.jsPageSpec === undefined || opts.jsPageSpec === null) {
throw new Error(
"Missing the required parameter 'opts.jsPageSpec' when calling createJsPageOfWebRule"
)
}
let postBody = {}
if (opts.jsPageSpec !== undefined && opts.jsPageSpec !== null) {
postBody['jsPageSpec'] = opts.jsPageSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createJsPageOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/jsPages',
'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)
}
)
}
/**
* 批量添加网站类规则允许插入JS指纹的页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {jsPagesSpec} opts.jsPagesSpec - 添加 JS 指纹页面请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createJsPagesOfWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createJsPagesOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createJsPagesOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling createJsPagesOfWebRule"
)
}
if (opts.jsPagesSpec === undefined || opts.jsPagesSpec === null) {
throw new Error(
"Missing the required parameter 'opts.jsPagesSpec' when calling createJsPagesOfWebRule"
)
}
let postBody = {}
if (opts.jsPagesSpec !== undefined && opts.jsPagesSpec !== null) {
postBody['jsPagesSpec'] = opts.jsPagesSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createJsPagesOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:createJsPagesOfWebRule',
'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)
}
)
}
/**
* 修改网站类规则允许插入 JS 指纹的页面
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.jsPageId - 支持插入JS指纹的页面 Id
* @param {jsPageSpec} opts.jsPageSpec - 修改网站类规则允许插入 JS 指纹的页面请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyJsPageOfWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyJsPageOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyJsPageOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyJsPageOfWebRule"
)
}
if (opts.jsPageId === undefined || opts.jsPageId === null) {
throw new Error(
"Missing the required parameter 'opts.jsPageId' when calling modifyJsPageOfWebRule"
)
}
if (opts.jsPageSpec === undefined || opts.jsPageSpec === null) {
throw new Error(
"Missing the required parameter 'opts.jsPageSpec' when calling modifyJsPageOfWebRule"
)
}
let postBody = {}
if (opts.jsPageSpec !== undefined && opts.jsPageSpec !== null) {
postBody['jsPageSpec'] = opts.jsPageSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
jsPageId: opts.jsPageId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyJsPageOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/jsPages/{jsPageId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除网站类规则允许插入 JS 指纹的页面。支持批量操作, 批量操作时 jsPageId 传多个, 以 ',' 分隔
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.jsPageId - 支持插入JS指纹的页面 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteJsPageOfWebRule (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteJsPageOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteJsPageOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling deleteJsPageOfWebRule"
)
}
if (opts.jsPageId === undefined || opts.jsPageId === null) {
throw new Error(
"Missing the required parameter 'opts.jsPageId' when calling deleteJsPageOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
jsPageId: opts.jsPageId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteJsPageOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/jsPages/{jsPageId}',
'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)
}
)
}
/**
* 关闭网站类规则的JS指纹开关
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWebRuleJsPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleJsPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleJsPage"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleJsPage"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleJsPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableWebRuleJsPage',
'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)
}
)
}
/**
* 打开网站类规则的JS指纹开关
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 打开失败, 1: 打开成功
* @param string message 打开失败时给出具体原因
*/
enableWebRuleJsPage (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleJsPage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleJsPage"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleJsPage"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleJsPage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableWebRuleJsPage',
'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)
}
)
}
/**
* 插入JS指纹到所有页面, 需要打开网站类规则的JS指纹开关
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyWebRuleJsPageToAll (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyWebRuleJsPageToAll"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyWebRuleJsPageToAll"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyWebRuleJsPageToAll"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyWebRuleJsPageToAll with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:modifyWebRuleJsPageToAll',
'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)
}
)
}
/**
* 插入JS指纹到配置的自定义页面, 需要打开网站类规则的JS指纹开关
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyWebRuleJsPageToCustom (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyWebRuleJsPageToCustom"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyWebRuleJsPageToCustom"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyWebRuleJsPageToCustom"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyWebRuleJsPageToCustom with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:modifyWebRuleJsPageToCustom',
'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)
}
)
}
/**
* 查询网站类规则的 CC 防护规则列表
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCProtectionRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeCCProtectionRulesOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCProtectionRulesOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeCCProtectionRulesOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeCCProtectionRulesOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCProtectionRulesOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules',
'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)
}
)
}
/**
* 添加网站类规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {cCProtectionRuleSpec} opts.ccProtectionRuleSpec - 添加 CC 防护规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling createCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleSpec === undefined ||
opts.ccProtectionRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleSpec' when calling createCCProtectionRuleOfWebRule"
)
}
let postBody = {}
if (
opts.ccProtectionRuleSpec !== undefined &&
opts.ccProtectionRuleSpec !== null
) {
postBody['ccProtectionRuleSpec'] = opts.ccProtectionRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules',
'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)
}
)
}
/**
* 查询网站类规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.ccProtectionRuleId - 网站类规则的 CC 防护规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCProtectionRule data
*/
describeCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleId === undefined ||
opts.ccProtectionRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleId' when calling describeCCProtectionRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
ccProtectionRuleId: opts.ccProtectionRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules/{ccProtectionRuleId}',
'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)
}
)
}
/**
* 修改网站类规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.ccProtectionRuleId - 网站类规则的 CC 防护规则 Id
* @param {cCProtectionRuleSpec} opts.ccProtectionRuleSpec - 修改 CC 防护规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleId === undefined ||
opts.ccProtectionRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleId' when calling modifyCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleSpec === undefined ||
opts.ccProtectionRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleSpec' when calling modifyCCProtectionRuleOfWebRule"
)
}
let postBody = {}
if (
opts.ccProtectionRuleSpec !== undefined &&
opts.ccProtectionRuleSpec !== null
) {
postBody['ccProtectionRuleSpec'] = opts.ccProtectionRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
ccProtectionRuleId: opts.ccProtectionRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules/{ccProtectionRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除网站规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.ccProtectionRuleId - 网站类规则的 CC 防护规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling deleteCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleId === undefined ||
opts.ccProtectionRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleId' when calling deleteCCProtectionRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
ccProtectionRuleId: opts.ccProtectionRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules/{ccProtectionRuleId}',
'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)
}
)
}
/**
* 开启网站类规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.ccProtectionRuleId - 网站类规则的 CC 防护规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleId === undefined ||
opts.ccProtectionRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleId' when calling enableCCProtectionRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
ccProtectionRuleId: opts.ccProtectionRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules/{ccProtectionRuleId}:enable',
'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)
}
)
}
/**
* 关闭网站类规则的 CC 防护规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.ccProtectionRuleId - 网站类规则的 CC 防护规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableCCProtectionRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableCCProtectionRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableCCProtectionRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableCCProtectionRuleOfWebRule"
)
}
if (
opts.ccProtectionRuleId === undefined ||
opts.ccProtectionRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionRuleId' when calling disableCCProtectionRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
ccProtectionRuleId: opts.ccProtectionRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableCCProtectionRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/ccProtectionRules/{ccProtectionRuleId}:disable',
'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)
}
)
}
/**
* 开启网站类规则的自定义 CC 防护规则总开关, 状态为开启的自定义 CC 防护规则生效
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableWebRuleCCProtectionRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleCCProtectionRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleCCProtectionRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleCCProtectionRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleCCProtectionRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableWebRuleCCProtectionRule',
'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)
}
)
}
/**
* 关闭网站类规则的自定义 CC 防护规则总开关, 所有自定义 CC 防护规则失效
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWebRuleCCProtectionRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleCCProtectionRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleCCProtectionRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleCCProtectionRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleCCProtectionRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableWebRuleCCProtectionRule',
'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)
}
)
}
/**
* 查询网站类规则的 CC 防护配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCProtectionConfig data
*/
describeCCProtectionConfigOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCProtectionConfigOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeCCProtectionConfigOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeCCProtectionConfigOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCProtectionConfigOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:ccProtectionConfig',
'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)
}
)
}
/**
* 修改网站类规则的 CC 防护配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {cCProtectionConfigSpec} opts.ccProtectionConfigSpec - 修改 CC 防护配置请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyCCProtectionConfigOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyCCProtectionConfigOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyCCProtectionConfigOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyCCProtectionConfigOfWebRule"
)
}
if (
opts.ccProtectionConfigSpec === undefined ||
opts.ccProtectionConfigSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.ccProtectionConfigSpec' when calling modifyCCProtectionConfigOfWebRule"
)
}
let postBody = {}
if (
opts.ccProtectionConfigSpec !== undefined &&
opts.ccProtectionConfigSpec !== null
) {
postBody['ccProtectionConfigSpec'] = opts.ccProtectionConfigSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyCCProtectionConfigOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:ccProtectionConfig',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则的 CC 防护默认配置
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param cCProtectionDefaultConfig data
*/
describeCCProtectionDefaultConfigOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeCCProtectionDefaultConfigOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeCCProtectionDefaultConfigOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeCCProtectionDefaultConfigOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeCCProtectionDefaultConfigOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:ccProtectionDefaultConfig',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 编辑网站规则证书信息
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {certInfoModifySpec} opts.certInfoModifySpec - 编辑网站规则证书信息请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 上传 SSL 证书结果, 0: 删除证书失败, 1: 删除证书成功
* @param string message 上传成功时为证书 Id, 失败时给出具体原因
*/
modifyCertInfo (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyCertInfo"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyCertInfo"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyCertInfo"
)
}
if (
opts.certInfoModifySpec === undefined ||
opts.certInfoModifySpec === null
) {
throw new Error(
"Missing the required parameter 'opts.certInfoModifySpec' when calling modifyCertInfo"
)
}
let postBody = {}
if (
opts.certInfoModifySpec !== undefined &&
opts.certInfoModifySpec !== null
) {
postBody['certInfoModifySpec'] = opts.certInfoModifySpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyCertInfo with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:modifyCertInfo',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类防护规则的黑名单用量信息
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer allocatedNum 已配置的黑名单规则数量
* @param integer activeNum 开启的黑名单规则数量
* @param integer surplusAllocateNum 还可添加的黑名单规则数量
* @param integer maxAllocateNum 最多可添加的黑名单规则数量
*/
describeWebRuleBlackListUsage (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRuleBlackListUsage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWebRuleBlackListUsage"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeWebRuleBlackListUsage"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRuleBlackListUsage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:describeWebRuleBlackListUsage',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则的黑名单规则列表
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webBlackListRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeBlackListRulesOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeBlackListRulesOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeBlackListRulesOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeBlackListRulesOfWebRule"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeBlackListRulesOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加网站类规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {webBlackListRuleSpec} opts.webBlackListRuleSpec - 添加网站类规则的黑名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling createBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleSpec === undefined ||
opts.webBlackListRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleSpec' when calling createBlackListRuleOfWebRule"
)
}
let postBody = {}
if (
opts.webBlackListRuleSpec !== undefined &&
opts.webBlackListRuleSpec !== null
) {
postBody['webBlackListRuleSpec'] = opts.webBlackListRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webBlackListRuleId - 网站类规则的黑名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webBlackListRule data
*/
describeBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleId === undefined ||
opts.webBlackListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleId' when calling describeBlackListRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webBlackListRuleId: opts.webBlackListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules/{webBlackListRuleId}',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改网站类规则的黑名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webBlackListRuleId - 网站类规则的黑名单规则 Id
* @param {webBlackListRuleSpec} opts.webBlackListRuleSpec - 修改网站类规则的黑名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 修改结果, 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleId === undefined ||
opts.webBlackListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleId' when calling modifyBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleSpec === undefined ||
opts.webBlackListRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleSpec' when calling modifyBlackListRuleOfWebRule"
)
}
let postBody = {}
if (
opts.webBlackListRuleSpec !== undefined &&
opts.webBlackListRuleSpec !== null
) {
postBody['webBlackListRuleSpec'] = opts.webBlackListRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webBlackListRuleId: opts.webBlackListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules/{webBlackListRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除网站类规则的黑名单规则, 批量操作时 webBlackListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webBlackListRuleId - 网站类规则的黑名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 删除结果, 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling deleteBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleId === undefined ||
opts.webBlackListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleId' when calling deleteBlackListRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webBlackListRuleId: opts.webBlackListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules/{webBlackListRuleId}',
'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.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableWebRuleBlackList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleBlackList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleBlackList"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleBlackList"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleBlackList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableWebRuleBlackList',
'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)
}
)
}
/**
* 开启网站类规则的黑名单规则, 批量操作时 webBlackListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webBlackListRuleId - 网站类规则的黑名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleId === undefined ||
opts.webBlackListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleId' when calling enableBlackListRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webBlackListRuleId: opts.webBlackListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules/{webBlackListRuleId}:enable',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 关闭网站类规则的黑名单
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWebRuleBlackList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleBlackList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleBlackList"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleBlackList"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleBlackList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableWebRuleBlackList',
'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)
}
)
}
/**
* 关闭网站类规则的黑名单规则, 批量操作时 webBlackListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webBlackListRuleId - 网站类规则的黑名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableBlackListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableBlackListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableBlackListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableBlackListRuleOfWebRule"
)
}
if (
opts.webBlackListRuleId === undefined ||
opts.webBlackListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webBlackListRuleId' when calling disableBlackListRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webBlackListRuleId: opts.webBlackListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableBlackListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webBlackListRules/{webBlackListRuleId}:disable',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类防护规则的白名单用量信息
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer allocatedNum 已配置的白名单规则数量
* @param integer activeNum 开启的白名单规则数量
* @param integer surplusAllocateNum 还可添加的白名单规则数量
* @param integer maxAllocateNum 最多可添加的白名单规则数量
*/
describeWebRuleWhiteListUsage (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRuleWhiteListUsage"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWebRuleWhiteListUsage"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeWebRuleWhiteListUsage"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRuleWhiteListUsage with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:describeWebRuleWhiteListUsage',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则的白名单规则列表
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {integer} [opts.pageNumber] - 页码, 默认为1 optional
* @param {integer} [opts.pageSize] - 分页大小, 默认为10, 取值范围[10, 100] optional
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webWhiteListRule dataList
* @param integer currentCount 当前页数量
* @param integer totalCount 总数
* @param integer totalPage 总页数
*/
describeWhiteListRulesOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWhiteListRulesOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWhiteListRulesOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeWhiteListRulesOfWebRule"
)
}
let postBody = null
let queryParams = {}
if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
queryParams['pageNumber'] = opts.pageNumber
}
if (opts.pageSize !== undefined && opts.pageSize !== null) {
queryParams['pageSize'] = opts.pageSize
}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWhiteListRulesOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 添加网站类规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {webWhiteListRuleSpec} opts.webWhiteListRuleSpec - 添加网站类规则的白名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 0: 添加失败, 1: 添加成功
* @param string message 添加失败时给出具体原因
*/
createWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling createWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling createWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling createWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleSpec === undefined ||
opts.webWhiteListRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleSpec' when calling createWhiteListRuleOfWebRule"
)
}
let postBody = {}
if (
opts.webWhiteListRuleSpec !== undefined &&
opts.webWhiteListRuleSpec !== null
) {
postBody['webWhiteListRuleSpec'] = opts.webWhiteListRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 createWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 查询网站类规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webWhiteListRuleId - 网站类规则的白名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param webWhiteListRule data
*/
describeWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling describeWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling describeWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleId === undefined ||
opts.webWhiteListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleId' when calling describeWhiteListRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webWhiteListRuleId: opts.webWhiteListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules/{webWhiteListRuleId}',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 修改网站类规则的白名单规则
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webWhiteListRuleId - 网站类规则的白名单规则 Id
* @param {webWhiteListRuleSpec} opts.webWhiteListRuleSpec - 修改网站类规则的白名单规则请求参数
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 修改结果, 0: 修改失败, 1: 修改成功
* @param string message 修改失败时给出具体原因
*/
modifyWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling modifyWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling modifyWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling modifyWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleId === undefined ||
opts.webWhiteListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleId' when calling modifyWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleSpec === undefined ||
opts.webWhiteListRuleSpec === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleSpec' when calling modifyWhiteListRuleOfWebRule"
)
}
let postBody = {}
if (
opts.webWhiteListRuleSpec !== undefined &&
opts.webWhiteListRuleSpec !== null
) {
postBody['webWhiteListRuleSpec'] = opts.webWhiteListRuleSpec
}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webWhiteListRuleId: opts.webWhiteListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 modifyWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules/{webWhiteListRuleId}',
'PATCH',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 删除网站类规则的白名单规则, 批量操作时 webWhiteListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webWhiteListRuleId - 网站类规则的白名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 删除结果, 0: 删除失败, 1: 删除成功
* @param string message 删除失败时给出具体原因
*/
deleteWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling deleteWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling deleteWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling deleteWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleId === undefined ||
opts.webWhiteListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleId' when calling deleteWhiteListRuleOfWebRule"
)
}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webWhiteListRuleId: opts.webWhiteListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 deleteWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules/{webWhiteListRuleId}',
'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.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableWebRuleWhiteList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWebRuleWhiteList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWebRuleWhiteList"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWebRuleWhiteList"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWebRuleWhiteList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:enableWebRuleWhiteList',
'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)
}
)
}
/**
* 开启网站类规则的白名单规则, 批量操作时 webWhiteListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webWhiteListRuleId - 网站类规则的白名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 开启结果, 0: 开启失败, 1: 开启成功
* @param string message 开启失败时给出具体原因
*/
enableWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling enableWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling enableWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling enableWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleId === undefined ||
opts.webWhiteListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleId' when calling enableWhiteListRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webWhiteListRuleId: opts.webWhiteListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 enableWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules/{webWhiteListRuleId}:enable',
'POST',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
/**
* 关闭网站类规则的白名单
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWebRuleWhiteList (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWebRuleWhiteList"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWebRuleWhiteList"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWebRuleWhiteList"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWebRuleWhiteList with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}:disableWebRuleWhiteList',
'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)
}
)
}
/**
* 关闭网站类规则的白名单规则, 批量操作时 webWhiteListRuleId 传多个, 以 ',' 分隔, 返回 result.code 为 1 表示操作成功, 为 0 时可能全部失败, 也可能部分失败
* @param {Object} opts - parameters
* @param {string} opts.instanceId - 高防实例 Id
* @param {string} opts.webRuleId - 网站规则 Id
* @param {string} opts.webWhiteListRuleId - 网站类规则的白名单规则 Id
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param integer code 关闭结果, 0: 关闭失败, 1: 关闭成功
* @param string message 关闭失败时给出具体原因
*/
disableWhiteListRuleOfWebRule (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling disableWhiteListRuleOfWebRule"
)
}
opts = opts || {}
if (opts.instanceId === undefined || opts.instanceId === null) {
throw new Error(
"Missing the required parameter 'opts.instanceId' when calling disableWhiteListRuleOfWebRule"
)
}
if (opts.webRuleId === undefined || opts.webRuleId === null) {
throw new Error(
"Missing the required parameter 'opts.webRuleId' when calling disableWhiteListRuleOfWebRule"
)
}
if (
opts.webWhiteListRuleId === undefined ||
opts.webWhiteListRuleId === null
) {
throw new Error(
"Missing the required parameter 'opts.webWhiteListRuleId' when calling disableWhiteListRuleOfWebRule"
)
}
let postBody = {}
let queryParams = {}
let pathParams = {
regionId: regionId,
instanceId: opts.instanceId,
webRuleId: opts.webRuleId,
webWhiteListRuleId: opts.webWhiteListRuleId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 disableWhiteListRuleOfWebRule with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/instances/{instanceId}/webRules/{webRuleId}/webWhiteListRules/{webWhiteListRuleId}:disable',
'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)
}
)
}
/**
* 查询网站类转发规则 Geo 模式的黑名单可设置区域编码
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param country dataList
*/
describeWebRuleBlackListGeoAreas (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRuleBlackListGeoAreas"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRuleBlackListGeoAreas with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeWebRuleBlackListGeoAreas',
'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)
}
)
}
/**
* 查询网站类转发规则 Geo 模式的白名单可设置区域编码
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param country dataList
*/
describeWebRuleWhiteListGeoAreas (
opts,
regionId = this.config.regionId,
callback
) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRuleWhiteListGeoAreas"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRuleWhiteListGeoAreas with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeWebRuleWhiteListGeoAreas',
'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)
}
)
}
/**
* 查询网站类转发规则按地域回源配置 geoRsRoute 可设置的区域
* @param {Object} opts - parameters
* @param {string} regionId - ID of the region
* @param {string} callback - callback
@return {Object} result
* @param country dataList
*/
describeWebRuleRSGeoAreas (opts, regionId = this.config.regionId, callback) {
if (typeof regionId === 'function') {
callback = regionId
regionId = this.config.regionId
}
if (regionId === undefined || regionId === null) {
throw new Error(
"Missing the required parameter 'regionId' when calling describeWebRuleRSGeoAreas"
)
}
opts = opts || {}
let postBody = null
let queryParams = {}
let pathParams = {
regionId: regionId
}
let headerParams = {
'User-Agent': 'JdcloudSdkNode/1.0.0 ipanti/1.12.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 describeWebRuleRSGeoAreas with params:\npathParams:${JSON.stringify(
pathParams
)},\nqueryParams:${JSON.stringify(
queryParams
)}, \nheaderParams:${JSON.stringify(
headerParams
)}, \nformParams:${JSON.stringify(
formParams
)}, \npostBody:${JSON.stringify(postBody)}`,
'DEBUG'
)
let request = super.makeRequest(
'/regions/{regionId}/describeWebRuleRSGeoAreas',
'GET',
pathParams,
queryParams,
headerParams,
formParams,
postBody,
contentTypes,
accepts,
returnType,
callback
)
return request.then(
function (result) {
if (callback && typeof callback === 'function') {
return callback(null, result)
}
return result
},
function (error) {
if (callback && typeof callback === 'function') {
return callback(error)
}
return Promise.reject(error)
}
)
}
}
module.exports = IPANTI