/* * 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. * * Table-Check * 表诊断相关接口 * * OpenAPI spec version: v2 * 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 = 'smartdba' Service._services[serviceId] = true /** * smartdba service. * @version 2.0.1 */ class SMARTDBA extends Service { constructor (options = {}) { options._defaultEndpoint = {} options._defaultEndpoint.protocol = options._defaultEndpoint.protocol || 'https' options._defaultEndpoint.host = options._defaultEndpoint.host || 'smartdba.jdcloud-api.com' options.basePath = '/v2' // 默认要设为空"" super(serviceId, options) } /** * 近一小时告警列表,按级别倒序 * @param {Object} opts - parameters * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞) optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10 optional * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} opts.endTime - null * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param alarmDetail data * @param integer totalCount 总数 */ describeAlarmResource (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAlarmResource" ) } opts = opts || {} if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeAlarmResource" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAlarmResource with 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}/describeAlarmResource', 'GET', pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts, returnType, callback ) return request.then( function (result) { if (callback && typeof callback === 'function') { return callback(null, result) } return result }, function (error) { if (callback && typeof callback === 'function') { return callback(error) } return Promise.reject(error) } ) } /** * 查询告警历史 * @param {Object} opts - parameters * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞) optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10 optional * @param {string} opts.startTime - 查询开始时间,格式为:2021-11-11T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} [opts.instanceGid] - 实例Id optional * @param {string} [opts.instanceName] - 实例名称 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param alarmHistoryDetail data * @param integer totalCount 总数 */ describeAlarmHistory (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAlarmHistory" ) } opts = opts || {} if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeAlarmHistory" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeAlarmHistory" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } 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.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } if (opts.instanceGid !== undefined && opts.instanceGid !== null) { queryParams['instanceGid'] = opts.instanceGid } if (opts.instanceName !== undefined && opts.instanceName !== null) { queryParams['instanceName'] = opts.instanceName } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAlarmHistory with 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}/describeAlarmHistory', '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) } ) } /** * 最近3小时,24小时,3天报警数量 * @param {Object} opts - parameters * @param {string} opts.endTime - 查询时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer count3h 最近3小时告警数量 * @param integer count24h 最近24小时告警数量 * @param integer count72h 最近72小时告警数量 */ describeAlarmStatistic (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAlarmStatistic" ) } opts = opts || {} if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeAlarmStatistic" ) } let postBody = null let queryParams = {} if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAlarmStatistic with 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}/alarmStatistic', '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) } ) } /** * 最近3小时,24小时,3天慢sql情况 * @param {Object} opts - parameters * @param {string} opts.endTime - 查询时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer count3h 最近3小时慢sql数量 * @param integer count24h 最近24小时慢sql数量 * @param integer count72h 最近72小时慢sql数量 */ describeslowLogStatistic (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeslowLogStatistic" ) } opts = opts || {} if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeslowLogStatistic" ) } let postBody = null let queryParams = {} if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeslowLogStatistic with 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}/slowLogStatistic', '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 - 查询起始时间,格式为:2021-11-11T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param dataPoint itemData * @param metric metricInfo metric元信息 */ describeAlarmTrend (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAlarmTrend" ) } opts = opts || {} if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeAlarmTrend" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeAlarmTrend" ) } 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.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAlarmTrend with 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}/alarmTrend', '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) } ) } /** * 最近5分钟(或历史某点5分钟),top5的资源 * @param {Object} opts - parameters * @param {string} opts.metric - 监控指标 * @param {string} opts.endTime - 查询时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param metricResourceModel data */ getTopResourceByMetric (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling getTopResourceByMetric" ) } opts = opts || {} if (opts.metric === undefined || opts.metric === null) { throw new Error( "Missing the required parameter 'opts.metric' when calling getTopResourceByMetric" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling getTopResourceByMetric" ) } let postBody = null let queryParams = {} if (opts.metric !== undefined && opts.metric !== null) { queryParams['metric'] = opts.metric } if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call getTopResourceByMetric with 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}/getTopResource', '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) } ) } /** * 获取一键诊断分数最低的top5 * @param {Object} opts - parameters * @param {string} opts.endTime - 查询时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param inspectTopResource data */ describeDiagnoseTopResource (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeDiagnoseTopResource" ) } opts = opts || {} if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeDiagnoseTopResource" ) } let postBody = null let queryParams = {} if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeDiagnoseTopResource with 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}/diagnoseTopResource', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} opts.endTime - 查询时间,格式为:2021-11-11T15:04:05Z * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param dataPoint data */ describeDiagnoseTrend (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeDiagnoseTrend" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeDiagnoseTrend" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeDiagnoseTrend" ) } let postBody = null let queryParams = {} if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeDiagnoseTrend with 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}/instance/{instanceGid}/diagnoseTrend', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string taskId 巡检任务id */ createDiagnose (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling createDiagnose" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling createDiagnose" ) } let postBody = {} let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call createDiagnose with 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}/instance/{instanceGid}/diagnose', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param diagnoseDetail data */ describeDiagnoseList (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeDiagnoseList" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeDiagnoseList" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeDiagnoseList with 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}/instance/{instanceGid}/diagnoses', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} opts.diagnoseId - 诊断任务id * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string status 巡检状态描述,取值 complete 或者 fail。如遇到云监控或者RDS服务异常,会出现fail。可提示用户诊断失败,请稍后重试。 * @param diagnoseDetail data */ describeDiagnose (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeDiagnose" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeDiagnose" ) } if (opts.diagnoseId === undefined || opts.diagnoseId === null) { throw new Error( "Missing the required parameter 'opts.diagnoseId' when calling describeDiagnose" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid, diagnoseId: opts.diagnoseId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeDiagnose with 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}/instance/{instanceGid}/diagnoses/{diagnoseId}', '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 - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} [opts.instanceGid] - 实例id optional * @param {string} [opts.instanceName] - 实例名称 optional * @param {string} [opts.dbType] - 实例类型 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param inspectTaskModel data */ describeInspectList (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeInspectList" ) } opts = opts || {} if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeInspectList" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeInspectList" ) } 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.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } if (opts.instanceGid !== undefined && opts.instanceGid !== null) { queryParams['instanceGid'] = opts.instanceGid } if (opts.instanceName !== undefined && opts.instanceName !== null) { queryParams['instanceName'] = opts.instanceName } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeInspectList with 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}/inspects', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} opts.inspectId - 巡检任务id * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer score 巡检分值 * @param string beginTime 巡检范围的起始时间,如:2021-11-09T00:00:00Z * @param string endTime 巡检范围的截至时间,如:2021-11-09T23:59:59Z * @param systemView systemView 资源使用率 * @param connectView connectView 连接数 * @param engineView engineView 锁信息 * @param schemaView schemaView 库表空间 * @param diskView diskView 磁盘空间 * @param slowLowView slowLowView 慢sql * @param kV detail */ describeInspect (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeInspect" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeInspect" ) } if (opts.inspectId === undefined || opts.inspectId === null) { throw new Error( "Missing the required parameter 'opts.inspectId' when calling describeInspect" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid, inspectId: opts.inspectId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeInspect with 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}/instance/{instanceGid}/inspects/{inspectId}', '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) } ) } /** * 获取待接入的mysql实例 * @param {Object} opts - parameters * @param {string} [opts.dbType] - 实例类型,支持MySQL/Percona,默认MySQL optional * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param instancesInfo data */ toBeConnectClusters (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling toBeConnectClusters" ) } opts = opts || {} let postBody = null let queryParams = {} if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call toBeConnectClusters with 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}/waitcutin', '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) } ) } /** * 获取已接入mysql实例列表 * @param {Object} opts - parameters * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} [opts.gid] - 实例gid optional * @param {string} [opts.instanceName] - 实例名称 optional * @param {string} [opts.dbSource] - 接入来源 optional * @param {string} [opts.status] - 实例状态 optional * @param {string} [opts.dbType] - 实例类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param integer checkOkCount 连接正常数 * @param integer checkFailCount 连接异常数 * @param instancesInfo data */ describeClusterList (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeClusterList" ) } opts = opts || {} let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } if (opts.gid !== undefined && opts.gid !== null) { queryParams['gid'] = opts.gid } if (opts.instanceName !== undefined && opts.instanceName !== null) { queryParams['instanceName'] = opts.instanceName } if (opts.dbSource !== undefined && opts.dbSource !== null) { queryParams['dbSource'] = opts.dbSource } if (opts.status !== undefined && opts.status !== null) { queryParams['status'] = opts.status } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeClusterList with 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}/hadcutin', '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) } ) } /** * 新接入mysql实例 * @param {Object} opts - parameters * @param {array} opts.gidList - 待接入实例gid列表 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param instancesInfo data */ createCluster (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling createCluster" ) } opts = opts || {} if (opts.gidList === undefined || opts.gidList === null) { throw new Error( "Missing the required parameter 'opts.gidList' when calling createCluster" ) } let postBody = {} if (opts.gidList !== undefined && opts.gidList !== null) { postBody['gidList'] = opts.gidList } let queryParams = {} let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call createCluster with 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}/newcutin', '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 {array} opts.gidList - 取消的实例gid列表 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param instancesInfo data */ cancleConnect (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling cancleConnect" ) } opts = opts || {} if (opts.gidList === undefined || opts.gidList === null) { throw new Error( "Missing the required parameter 'opts.gidList' when calling cancleConnect" ) } let postBody = {} if (opts.gidList !== undefined && opts.gidList !== null) { postBody['gidList'] = opts.gidList } let queryParams = {} let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call cancleConnect with 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}/cancelinstance', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param clusterDetail data */ describeClusterDetail (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeClusterDetail" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeClusterDetail" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeClusterDetail with 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}/instance/{instanceGid}/describeClusterDetail', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} opts.analyseId - 锁诊断Id * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string analyseId 锁诊断记录Id * @param string occurTime 锁发生时间 * @param string deadLockLog 死锁日志详情 * @param deadLockDetail data */ describeLockAnalyse (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeLockAnalyse" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeLockAnalyse" ) } if (opts.analyseId === undefined || opts.analyseId === null) { throw new Error( "Missing the required parameter 'opts.analyseId' when calling describeLockAnalyse" ) } let postBody = null let queryParams = {} if (opts.analyseId !== undefined && opts.analyseId !== null) { queryParams['analyseId'] = opts.analyseId } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeLockAnalyse with 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}/instance/{instanceGid}/lockAnalyse', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string analyseId 锁诊断id * @param string state 诊断完成状态:complete\fail * @param string message 状态说明信息 */ createLockAnalyse (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling createLockAnalyse" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling createLockAnalyse" ) } let postBody = {} let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call createLockAnalyse with 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}/instance/{instanceGid}/lockAnalyse', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码 optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} opts.startTime - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {boolean} [opts.state] - 是否只过滤死锁存在的记录 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param deadLockOverview data */ describeAnalyseList (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAnalyseList" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeAnalyseList" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeAnalyseList" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeAnalyseList" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } 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.state !== undefined && opts.state !== null) { queryParams['state'] = opts.state } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAnalyseList with 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}/instance/{instanceGid}/analyseList', '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 {} [opts.name] - 监控大盘名称,最长32位 optional * @param {} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string name 监控大盘名称 * @param string panelGid 监控大盘id */ createPanel (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling createPanel" ) } opts = opts || {} let postBody = {} if (opts.name !== undefined && opts.name !== null) { postBody['name'] = opts.name } if (opts.dbType !== undefined && opts.dbType !== null) { postBody['dbType'] = opts.dbType } let queryParams = {} let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call createPanel with 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}/panel', '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.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param panel data */ describePanelList (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describePanelList" ) } opts = opts || {} let postBody = null let queryParams = {} if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describePanelList with 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}/panels', '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.panelGid - 监控大盘id * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param panelClusterItem data */ getPanelRelateClusters (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling getPanelRelateClusters" ) } opts = opts || {} if (opts.panelGid === undefined || opts.panelGid === null) { throw new Error( "Missing the required parameter 'opts.panelGid' when calling getPanelRelateClusters" ) } let postBody = null let queryParams = {} if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId, panelGid: opts.panelGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call getPanelRelateClusters with 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}/panels/{panelGid}', '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.panelGid - 监控大盘id * @param {} [opts.instanceIdList] optional * @param {} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result */ updatePanelClusters (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling updatePanelClusters" ) } opts = opts || {} if (opts.panelGid === undefined || opts.panelGid === null) { throw new Error( "Missing the required parameter 'opts.panelGid' when calling updatePanelClusters" ) } let postBody = {} if (opts.instanceIdList !== undefined && opts.instanceIdList !== null) { postBody['instanceIdList'] = opts.instanceIdList } if (opts.dbType !== undefined && opts.dbType !== null) { postBody['dbType'] = opts.dbType } let queryParams = {} let pathParams = { regionId: regionId, panelGid: opts.panelGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call updatePanelClusters with 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}/panels/{panelGid}', '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.panelGid - 监控大盘id * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result */ deletePanel (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling deletePanel" ) } opts = opts || {} if (opts.panelGid === undefined || opts.panelGid === null) { throw new Error( "Missing the required parameter 'opts.panelGid' when calling deletePanel" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, panelGid: opts.panelGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call deletePanel with 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}/panels/{panelGid}', '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.panelGid - 监控大盘id * @param {string} opts.metric - 监控指标,如: tps、qps 等,在supportMetrics接口有返回 * @param {string} opts.startTime - 查询起始时间,格式为:2021-11-11T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2021-11-11T15:04:05Z * @param {string} [opts.dbType] - 数据库类型,默认MySQL optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param metricData metricDatas */ describePanelMetricValueByGid ( opts, regionId = this.config.regionId, callback ) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describePanelMetricValueByGid" ) } opts = opts || {} if (opts.panelGid === undefined || opts.panelGid === null) { throw new Error( "Missing the required parameter 'opts.panelGid' when calling describePanelMetricValueByGid" ) } if (opts.metric === undefined || opts.metric === null) { throw new Error( "Missing the required parameter 'opts.metric' when calling describePanelMetricValueByGid" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describePanelMetricValueByGid" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describePanelMetricValueByGid" ) } 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.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId, panelGid: opts.panelGid, metric: opts.metric } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describePanelMetricValueByGid with 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}/panels/{panelGid}/metric/{metric}', '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.panelType - 展示类型,取值为: real_time 表示实时监控页面支持的自定义类型, monitor 表示性能趋势页面支持的类型, market 表示监控大盘 * @param {string} opts.dbType - 数据库库类型,目前只支持MySQL * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param supportMetric sys * @param supportMetric server */ describeSupportMetrics (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSupportMetrics" ) } opts = opts || {} if (opts.panelType === undefined || opts.panelType === null) { throw new Error( "Missing the required parameter 'opts.panelType' when calling describeSupportMetrics" ) } if (opts.dbType === undefined || opts.dbType === null) { throw new Error( "Missing the required parameter 'opts.dbType' when calling describeSupportMetrics" ) } let postBody = null let queryParams = {} if (opts.panelType !== undefined && opts.panelType !== null) { queryParams['panelType'] = opts.panelType } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSupportMetrics with 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}/supportMetrics', '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.gid - panelType为real_time/monitor时,代表实例Id, panelType为market时,代表大盘 panelGid * @param {string} opts.panelType - 展示类型,取值为: real_time 表示实时监控页面支持的自定义类型, monitor 表示性能趋势页面支持的类型 * @param {string} opts.dbType - 数据库库类型,目前只支持MySQL * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param supportMetric sys * @param supportMetric server */ getBindMetrics (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling getBindMetrics" ) } opts = opts || {} if (opts.gid === undefined || opts.gid === null) { throw new Error( "Missing the required parameter 'opts.gid' when calling getBindMetrics" ) } if (opts.panelType === undefined || opts.panelType === null) { throw new Error( "Missing the required parameter 'opts.panelType' when calling getBindMetrics" ) } if (opts.dbType === undefined || opts.dbType === null) { throw new Error( "Missing the required parameter 'opts.dbType' when calling getBindMetrics" ) } let postBody = null let queryParams = {} if (opts.panelType !== undefined && opts.panelType !== null) { queryParams['panelType'] = opts.panelType } if (opts.dbType !== undefined && opts.dbType !== null) { queryParams['dbType'] = opts.dbType } let pathParams = { regionId: regionId, gid: opts.gid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call getBindMetrics with 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}/instance/{gid}/getBindMetrics', '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 {} [opts.metricIds] - 自定义的监控项id数组 optional * @param {} [opts.panelType] - 展示类型,取值为: real_time 表示实时监控页面, monitor 表示性能趋势页面 market 表示监控大盘 optional * @param {} [opts.gid] - RDS 实例ID,唯一标识一个RDS实例。如果全部实例生效,可以传all optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result */ bindMetrics (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling bindMetrics" ) } opts = opts || {} let postBody = {} if (opts.metricIds !== undefined && opts.metricIds !== null) { postBody['metricIds'] = opts.metricIds } if (opts.panelType !== undefined && opts.panelType !== null) { postBody['panelType'] = opts.panelType } if (opts.gid !== undefined && opts.gid !== null) { postBody['gid'] = opts.gid } let queryParams = {} let pathParams = { regionId: regionId } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call bindMetrics with 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}/bindMetrics', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} opts.metric - metric名称 * @param {string} opts.startTime - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {string} [opts.role] - 实例角色,默认master optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param dataPoint itemData * @param metric metricInfo metric元信息 */ describeMetricValueByGid (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeMetricValueByGid" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeMetricValueByGid" ) } if (opts.metric === undefined || opts.metric === null) { throw new Error( "Missing the required parameter 'opts.metric' when calling describeMetricValueByGid" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeMetricValueByGid" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeMetricValueByGid" ) } let postBody = null let queryParams = {} if (opts.metric !== undefined && opts.metric !== null) { queryParams['metric'] = opts.metric } if (opts.startTime !== undefined && opts.startTime !== null) { queryParams['startTime'] = opts.startTime } if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } if (opts.role !== undefined && opts.role !== null) { queryParams['role'] = opts.role } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeMetricValueByGid with 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}/instance/{instanceGid}/metrics', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer upTime 实例已运行时间,单位:s * @param integer activeSession 运行中会话总数 * @param integer maxActiveTime 运行中会话最长时间 * @param integer waitSession 存在事务等待的会话 * @param integer totalSession 会话总数 * @param integer systemsSession DMS(系统)会话总数 * @param integer totalCount 总数 * @param session sessions 实时会话明细 * @param userStatistic userStatistics 按用户统计 * @param hostStatistic hostStatistics 按访问来源统计 * @param dBStatistic dbStatistics 按数据库统计 */ describeSessions (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSessions" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSessions" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSessions with 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}/instance/{instanceGid}/describeSessions', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param nowSession data 实时会话 */ describeNowSessions (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeNowSessions" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeNowSessions" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeNowSessions with 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}/instance/{instanceGid}/describeNowSessions', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param lockStatistic data 事务锁 */ describeTrxLocks (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeTrxLocks" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeTrxLocks" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeTrxLocks with 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}/instance/{instanceGid}/describeTrxLocks', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param untrxLock data 非事务锁 */ describeUntrxLocks (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeUntrxLocks" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeUntrxLocks" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeUntrxLocks with 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}/instance/{instanceGid}/describeUntrxLocks', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param integer totalCount 总数 * @param unCommitTrx data 未提交事务 */ describeUnCommitTrxs (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeUnCommitTrxs" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeUnCommitTrxs" ) } let postBody = null let queryParams = {} if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeUnCommitTrxs with 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}/instance/{instanceGid}/describeUnCommitTrxs', '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) } ) } /** * kill当前实例指定的会话 * @param {Object} opts - parameters * @param {string} opts.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {} [opts.sessionId] optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result */ killSession (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling killSession" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling killSession" ) } let postBody = {} if (opts.sessionId !== undefined && opts.sessionId !== null) { postBody['sessionId'] = opts.sessionId } let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call killSession with 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}/instance/{instanceGid}/killSession', '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) } ) } /** * 获取当前实例指定时间的慢SQL明细 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {string} opts.startTime - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {string} [opts.dbName] - 过滤条件:数据库名 optional * @param {string} [opts.userName] - 过滤条件:client 用户名 optional * @param {string} [opts.clientIP] - 过滤条件:client IP optional * @param {string} [opts.keyword4Search] - 模糊查询关键字,只支持单个单词 optional * @param {string} [opts.field] - 排序的字段,支持 execTime,lockTime,rowsExamined,rowsSent,startTime 默认是 startTime optional * @param {string} [opts.sort] - 排序方式,默认desc optional * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param slowLog data * @param integer totalCount 总数 */ describeSlowLog (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSlowLog" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSlowLog" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeSlowLog" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeSlowLog" ) } 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.dbName !== undefined && opts.dbName !== null) { queryParams['dbName'] = opts.dbName } if (opts.userName !== undefined && opts.userName !== null) { queryParams['userName'] = opts.userName } if (opts.clientIP !== undefined && opts.clientIP !== null) { queryParams['clientIP'] = opts.clientIP } if (opts.keyword4Search !== undefined && opts.keyword4Search !== null) { queryParams['keyword4Search'] = opts.keyword4Search } if (opts.field !== undefined && opts.field !== null) { queryParams['field'] = opts.field } if (opts.sort !== undefined && opts.sort !== null) { queryParams['sort'] = opts.sort } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSlowLog with 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}/instance/{instanceGid}/slowLog', '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) } ) } /** * 获取当前实例指定时间的慢SQL统计 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {string} opts.startTime - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {string} [opts.dbName] - 过滤条件:数据库名 optional * @param {string} [opts.userName] - 过滤条件:client 用户名 optional * @param {string} [opts.clientIP] - 过滤条件:client IP optional * @param {string} [opts.keyword4Search] - 模糊查询关键字,只支持单个单词 optional * @param {string} [opts.sort] - 按queryCount的排序方式,默认desc optional * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param slowDigestLog data * @param integer totalCount 总数 */ describeSlowDigestLog (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSlowDigestLog" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSlowDigestLog" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeSlowDigestLog" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeSlowDigestLog" ) } 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.dbName !== undefined && opts.dbName !== null) { queryParams['dbName'] = opts.dbName } if (opts.userName !== undefined && opts.userName !== null) { queryParams['userName'] = opts.userName } if (opts.clientIP !== undefined && opts.clientIP !== null) { queryParams['clientIP'] = opts.clientIP } if (opts.keyword4Search !== undefined && opts.keyword4Search !== null) { queryParams['keyword4Search'] = opts.keyword4Search } if (opts.sort !== undefined && opts.sort !== null) { queryParams['sort'] = opts.sort } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSlowDigestLog with 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}/instance/{instanceGid}/slowDigestLog', '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) } ) } /** * 获取实例时间范围内按 dbName、userName、clientIP 分组统计的慢sql条数信息 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {string} opts.startTime - 查询开始时间,格式为:2021-11-12T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2021-11-11T15:04:05Z * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param object dbName 数据库名信息 * @param object userName 访问的用户名信息 * @param object clientIP 客户端IP信息 */ describeSlowLogDimensionsStatistic ( opts, regionId = this.config.regionId, callback ) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSlowLogDimensionsStatistic" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSlowLogDimensionsStatistic" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeSlowLogDimensionsStatistic" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeSlowLogDimensionsStatistic" ) } 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 } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSlowLogDimensionsStatistic with 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}/instance/{instanceGid}/SlowLogDimensionsStatistic', '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) } ) } /** * SQL explain执行计划 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {} [opts.database] - 数据库名 optional * @param {} [opts.sql] - SQL语句 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param executionPlan data */ explainSql (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling explainSql" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling explainSql" ) } let postBody = {} if (opts.database !== undefined && opts.database !== null) { postBody['database'] = opts.database } if (opts.sql !== undefined && opts.sql !== null) { postBody['sql'] = opts.sql } let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call explainSql with 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}/instance/{instanceGid}/explainSql', '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) } ) } /** * SQL优化 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {} [opts.database] - 数据库名 optional * @param {} [opts.sql] - SQL语句 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param tuningAdvice tuningAdvice 优化结果 */ turningSql (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling turningSql" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling turningSql" ) } let postBody = {} if (opts.database !== undefined && opts.database !== null) { postBody['database'] = opts.database } if (opts.sql !== undefined && opts.sql !== null) { postBody['sql'] = opts.sql } let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call turningSql with 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}/instance/{instanceGid}/tuningSql', '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) } ) } /** * 查询慢sql次数及分布 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {string} opts.metric - metric名称 * @param {string} opts.startTime - 查询开始时间,格式为:2021-11-11T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2021-11-11T15:04:05Z * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param dataPoint itemData * @param metric metricInfo metric元信息 */ describeSlowSqlMetric (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSlowSqlMetric" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSlowSqlMetric" ) } if (opts.metric === undefined || opts.metric === null) { throw new Error( "Missing the required parameter 'opts.metric' when calling describeSlowSqlMetric" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeSlowSqlMetric" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeSlowSqlMetric" ) } let postBody = null let queryParams = {} if (opts.metric !== undefined && opts.metric !== null) { queryParams['metric'] = opts.metric } if (opts.startTime !== undefined && opts.startTime !== null) { queryParams['startTime'] = opts.startTime } if (opts.endTime !== undefined && opts.endTime !== null) { queryParams['endTime'] = opts.endTime } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSlowSqlMetric with 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}/instance/{instanceGid}/sqlMetrics', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} opts.indexType - 索引类型 * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码; optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param indexInfo data */ describeIndexs (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeIndexs" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeIndexs" ) } if (opts.indexType === undefined || opts.indexType === null) { throw new Error( "Missing the required parameter 'opts.indexType' when calling describeIndexs" ) } let postBody = null let queryParams = {} if (opts.indexType !== undefined && opts.indexType !== null) { queryParams['indexType'] = opts.indexType } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeIndexs with 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}/instance/{instanceGid}/describeIndexs', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string totalDiskSize 总空间(单位:G) * @param string usedDiskSize 已用空间(单位:G) * @param string totalIncreaseSize 最近一周增长量(单位:G) * @param string averageIncrease 最近一周平均增长率 * @param string freeDiskSize 剩余空间(单位:G) * @param string predictAvailableDays 预计剩余可用天数 */ describeStorages (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeStorages" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeStorages" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeStorages with 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}/instance/{instanceGid}/describeStorages', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} opts.startTime - 查询开始时间,格式为:2006-01-02T15:04:05Z * @param {string} opts.endTime - 查询截止时间,格式为:2006-01-02T15:04:05Z * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param metricData data */ describeStorageTrend (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeStorageTrend" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeStorageTrend" ) } if (opts.startTime === undefined || opts.startTime === null) { throw new Error( "Missing the required parameter 'opts.startTime' when calling describeStorageTrend" ) } if (opts.endTime === undefined || opts.endTime === null) { throw new Error( "Missing the required parameter 'opts.endTime' when calling describeStorageTrend" ) } 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 } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeStorageTrend with 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}/instance/{instanceGid}/describeStorageTrend', '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) } ) } /** * 表空间Top 10 * @param {Object} opts - parameters * @param {string} opts.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} [opts.sortField] - 排序字段:表空间(totalSize)、表数据空间(dataSize)、索引空间(idxSize)、碎片率(fragment)、行数(dataRows) optional * @param {string} [opts.sortType] - 排序类型,desc 降序、asc 升序,默认降序 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param tableStorageInfo data */ describeTableSpaceTop (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeTableSpaceTop" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeTableSpaceTop" ) } let postBody = null let queryParams = {} if (opts.sortField !== undefined && opts.sortField !== null) { queryParams['sortField'] = opts.sortField } if (opts.sortType !== undefined && opts.sortType !== null) { queryParams['sortType'] = opts.sortType } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeTableSpaceTop with 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}/instance/{instanceGid}/tableSpaceTop', '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) } ) } /** * 库空间Top 10 * @param {Object} opts - parameters * @param {string} opts.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} [opts.sortField] - 排序字段:表空间(totalSize)、表数据空间(dataSize)、索引空间(idxSize)、碎片率(fragment)、行数(dataRows) optional * @param {string} [opts.sortType] - 排序类型,desc 降序、asc 升序,默认降序 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param tableStorageInfo data */ describeSchemaSpaceTop (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSchemaSpaceTop" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSchemaSpaceTop" ) } let postBody = null let queryParams = {} if (opts.sortField !== undefined && opts.sortField !== null) { queryParams['sortField'] = opts.sortField } if (opts.sortType !== undefined && opts.sortType !== null) { queryParams['sortType'] = opts.sortType } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSchemaSpaceTop with 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}/instance/{instanceGid}/schemaSpaceTop', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} [opts.sortField] - 排序字段:表空间(totalSize)、表数据空间(dataSize)、索引空间(idxSize)、碎片率(fragment)、行数(dataRows) optional * @param {string} [opts.sortType] - 排序类型,desc 降序、asc 升序,默认降序 optional * @param {string} [opts.dbName] - 过滤的数据库名 optional * @param {string} [opts.tableName] - 过滤的表名 optional * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞)。pageIndex 为-1时,返回所有数据页码 optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100],用于查询列表的接口 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param tableStorageInfo data * @param integer totalCount 总数 */ describeTableSpaceDetail (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeTableSpaceDetail" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeTableSpaceDetail" ) } let postBody = null let queryParams = {} if (opts.sortField !== undefined && opts.sortField !== null) { queryParams['sortField'] = opts.sortField } if (opts.sortType !== undefined && opts.sortType !== null) { queryParams['sortType'] = opts.sortType } if (opts.dbName !== undefined && opts.dbName !== null) { queryParams['dbName'] = opts.dbName } if (opts.tableName !== undefined && opts.tableName !== null) { queryParams['tableName'] = opts.tableName } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeTableSpaceDetail with 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}/instance/{instanceGid}/tableSpaceDetail', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string data */ describeAllDbInfo (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAllDbInfo" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeAllDbInfo" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAllDbInfo with 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}/instance/{instanceGid}/allDbInfo', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例。 * @param {string} [opts.dbName] - 数据库名 optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param string data */ describeAllTableInfoForDb (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeAllTableInfoForDb" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeAllTableInfoForDb" ) } let postBody = null let queryParams = {} if (opts.dbName !== undefined && opts.dbName !== null) { queryParams['dbName'] = opts.dbName } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeAllTableInfoForDb with 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}/instance/{instanceGid}/allTableInfoForDb', '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.instanceGid - RDS 实例ID,唯一标识一个RDS实例 * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param bufferPoolInfo bufferPoolInfo Buffer Pool信息 * @param connectionInfo connectionInfo 连接信息 * @param serverInfo serverInfo Server信息 */ describeSystemInfo (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling describeSystemInfo" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling describeSystemInfo" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call describeSystemInfo with 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}/instance/{instanceGid}/systemInfo', '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.instanceGid - 实例ID * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param table data */ checkTableTypes (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling checkTableTypes" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling checkTableTypes" ) } let postBody = null let queryParams = {} let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call checkTableTypes with 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}/instance/{instanceGid}/checkTableTypes', 'GET', pathParams, queryParams, headerParams, formParams, postBody, contentTypes, accepts, returnType, callback ) return request.then( function (result) { if (callback && typeof callback === 'function') { return callback(null, result) } return result }, function (error) { if (callback && typeof callback === 'function') { return callback(error) } return Promise.reject(error) } ) } /** * 根据诊断id进行表诊断 * @param {Object} opts - parameters * @param {string} opts.instanceGid - 实例ID * @param {integer} opts.checkTypeId - 诊断类型id * @param {integer} [opts.pageIndex] - 显示数据的页码,默认为1,取值范围:[-1,∞) pageIndex 为-1时,返回所有数据页码 optional * @param {integer} [opts.pageSize] - 每页显示的数据条数,默认为10,取值范围:[1,100] optional * @param {string} regionId - ID of the region * @param {string} callback - callback @return {Object} result * @param fieldList data * @param integer totalCount 总条数 */ checkTableByType (opts, regionId = this.config.regionId, callback) { if (typeof regionId === 'function') { callback = regionId regionId = this.config.regionId } if (regionId === undefined || regionId === null) { throw new Error( "Missing the required parameter 'regionId' when calling checkTableByType" ) } opts = opts || {} if (opts.instanceGid === undefined || opts.instanceGid === null) { throw new Error( "Missing the required parameter 'opts.instanceGid' when calling checkTableByType" ) } if (opts.checkTypeId === undefined || opts.checkTypeId === null) { throw new Error( "Missing the required parameter 'opts.checkTypeId' when calling checkTableByType" ) } let postBody = null let queryParams = {} if (opts.checkTypeId !== undefined && opts.checkTypeId !== null) { queryParams['checkTypeId'] = opts.checkTypeId } if (opts.pageIndex !== undefined && opts.pageIndex !== null) { queryParams['pageIndex'] = opts.pageIndex } if (opts.pageSize !== undefined && opts.pageSize !== null) { queryParams['pageSize'] = opts.pageSize } let pathParams = { regionId: regionId, instanceGid: opts.instanceGid } let headerParams = { 'User-Agent': 'JdcloudSdkNode/1.0.0 smartdba/2.0.1' } let contentTypes = ['application/json'] let accepts = ['application/json'] // 扩展自定义头 if (opts['x-extra-header']) { for (let extraHeader in opts['x-extra-header']) { headerParams[extraHeader] = opts['x-extra-header'][extraHeader] } if (Array.isArray(opts['x-extra-header']['content-type'])) { contentTypes = opts['x-extra-header']['content-type'] } else if (typeof opts['x-extra-header']['content-type'] === 'string') { contentTypes = opts['x-extra-header']['content-type'].split(',') } if (Array.isArray(opts['x-extra-header']['accept'])) { accepts = opts['x-extra-header']['accept'] } else if (typeof opts['x-extra-header']['accept'] === 'string') { accepts = opts['x-extra-header']['accept'].split(',') } } let formParams = {} let returnType = null this.config.logger( `call checkTableByType with 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}/instance/{instanceGid}/checkTables', '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 = SMARTDBA