text: /*
   * 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.
   *
   * 单库上云
   * 单库上云相关接口
   *
   * OpenAPI spec version: v1
   * Contact:
   *
   * NOTE: This class is auto generated by the jdcloud code generator program.
   */
  
  require('../../../lib/node_loader')
  var JDCloud = require('../../../lib/core')
  var Service = JDCloud.Service
  var serviceId = 'rds'
  Service._services[serviceId] = true
  
  /**
   * rds service.
   * @version 0.2.3
   */
  
  JDCloud.RDS = class RDS extends Service {
    constructor (options = {}) {
      options._defaultEndpoint = {}
      options._defaultEndpoint.protocol =
        options._defaultEndpoint.protocol || 'https'
      options._defaultEndpoint.host =
        options._defaultEndpoint.host || 'rds.jdcloud-api.com'
      options.basePath = '/v1' // 默认要设为空""
      super(serviceId, options)
    }
  
    /**
        *  创建数据库账户
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {} opts.accountName - 用户名
        * @param {} opts.accountPassword - 用户密码
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    createAccount (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  createAccount"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling createAccount"
        )
      }
      if (opts.accountName === undefined || opts.accountName === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountName' when calling createAccount"
        )
      }
      if (opts.accountPassword === undefined || opts.accountPassword === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountPassword' when calling createAccount"
        )
      }
  
      let postBody = {}
      if (opts.accountName !== undefined && opts.accountName !== null) {
        postBody['accountName'] = opts.accountName
      }
      if (opts.accountPassword !== undefined && opts.accountPassword !== null) {
        postBody['accountPassword'] = opts.accountPassword
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call createAccount with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/accounts',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  删除数据库账户
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.accountName - 账户名
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    deleteAccount (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  deleteAccount"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling deleteAccount"
        )
      }
      if (opts.accountName === undefined || opts.accountName === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountName' when calling deleteAccount"
        )
      }
  
      let postBody = null
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        accountName: opts.accountName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call deleteAccount with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/accounts/{accountName}',
        'DELETE',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  数据库账号授权
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.accountName - 账户名
        * @param {array} opts.accountPrivileges - 账号的访问权限
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    grantPrivilege (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  grantPrivilege"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling grantPrivilege"
        )
      }
      if (opts.accountName === undefined || opts.accountName === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountName' when calling grantPrivilege"
        )
      }
      if (
        opts.accountPrivileges === undefined ||
        opts.accountPrivileges === null
      ) {
        throw new Error(
          "Missing the required parameter 'opts.accountPrivileges' when calling grantPrivilege"
        )
      }
  
      let postBody = {}
      if (
        opts.accountPrivileges !== undefined &&
        opts.accountPrivileges !== null
      ) {
        postBody['accountPrivileges'] = opts.accountPrivileges
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        accountName: opts.accountName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call grantPrivilege with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/accounts/{accountName}:grantPrivilege',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  数据库账号重置密码
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.accountName - 账户名
        * @param {} opts.accountPassword - 新密码
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    resetPassword (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  resetPassword"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling resetPassword"
        )
      }
      if (opts.accountName === undefined || opts.accountName === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountName' when calling resetPassword"
        )
      }
      if (opts.accountPassword === undefined || opts.accountPassword === null) {
        throw new Error(
          "Missing the required parameter 'opts.accountPassword' when calling resetPassword"
        )
      }
  
      let postBody = {}
      if (opts.accountPassword !== undefined && opts.accountPassword !== null) {
        postBody['accountPassword'] = opts.accountPassword
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        accountName: opts.accountName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call resetPassword with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/accounts/{accountName}:resetPassword',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  获取备份信息
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {integer} [opts.auto] - 查询备份类型，0为手动备份，1为自动备份，不传表示全部. - 测试参数，后续可能被其他参数取代  optional
        * @param {string} [opts.backupTypeFilter] - 返回backupType等于指定值的备份列表。full为全量备份，diff为增量备份- 测试参数，后续可能被其他参数取代  optional
        * @param {string} [opts.dbNameFilter] - 返回dbName等于指定值的备份列表，不传或为空返回全部- 测试参数，后续可能被其他参数取代  optional
        * @param {string} [opts.backupTimeRangeStartFilter] - 返回备份开始时间大于该时间的备份列表- 测试参数，后续可能被其他参数取代  optional
        * @param {string} [opts.backupTimeRangeEndFilter] - 返回备份开始时间小于等于该时间的备份列表- 测试参数，后续可能被其他参数取代  optional
        * @param {integer} opts.pageNumber - 显示数据的页码，取值范围：[1,1000)，页码超过总页数时，显示最后一页，用于查询列表的接口
        * @param {integer} opts.pageSize - 每页显示的数据条数，取值范围：10/20/30/50/100
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        * @param backup backup
        * @param integer totalCount
        */
  
    describeBackups (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  describeBackups"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling describeBackups"
        )
      }
      if (opts.pageNumber === undefined || opts.pageNumber === null) {
        throw new Error(
          "Missing the required parameter 'opts.pageNumber' when calling describeBackups"
        )
      }
      if (opts.pageSize === undefined || opts.pageSize === null) {
        throw new Error(
          "Missing the required parameter 'opts.pageSize' when calling describeBackups"
        )
      }
  
      let postBody = null
      let queryParams = {}
      if (opts.instanceId !== undefined && opts.instanceId !== null) {
        queryParams['instanceId'] = opts.instanceId
      }
      if (opts.auto !== undefined && opts.auto !== null) {
        queryParams['auto'] = opts.auto
      }
      if (opts.backupTypeFilter !== undefined && opts.backupTypeFilter !== null) {
        queryParams['backupTypeFilter'] = opts.backupTypeFilter
      }
      if (opts.dbNameFilter !== undefined && opts.dbNameFilter !== null) {
        queryParams['dbNameFilter'] = opts.dbNameFilter
      }
      if (
        opts.backupTimeRangeStartFilter !== undefined &&
        opts.backupTimeRangeStartFilter !== null
      ) {
        queryParams['backupTimeRangeStartFilter'] =
          opts.backupTimeRangeStartFilter
      }
      if (
        opts.backupTimeRangeEndFilter !== undefined &&
        opts.backupTimeRangeEndFilter !== null
      ) {
        queryParams['backupTimeRangeEndFilter'] = opts.backupTimeRangeEndFilter
      }
      if (opts.pageNumber !== undefined && opts.pageNumber !== null) {
        queryParams['pageNumber'] = opts.pageNumber
      }
      if (opts.pageSize !== undefined && opts.pageSize !== null) {
        queryParams['pageSize'] = opts.pageSize
      }
  
      let pathParams = {
        regionId: regionId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call describeBackups with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/backups',
        'GET',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  创建备份
        * @param {Object} opts - parameters
        * @param {string} [opts.instanceId] - 集群ID  optional
        * @param {backupSpec} [opts.backupSpec] - 备份规格  optional
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    createBackup (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  createBackup"
        )
      }
  
      opts = opts || {}
  
      let postBody = {}
      if (opts.instanceId !== undefined && opts.instanceId !== null) {
        postBody['instanceId'] = opts.instanceId
      }
      if (opts.backupSpec !== undefined && opts.backupSpec !== null) {
        postBody['backupSpec'] = opts.backupSpec
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call createBackup with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/backups',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  获取备份下载链接
        * @param {Object} opts - parameters
        * @param {string} opts.backupId - 备份ID
        * @param {string} [opts.fileName] - MySQL：无需此参数；SQL Server：指定该备份中需要获取下载链接的文件名称，SQL Server必须输入该参数  optional
        * @param {string} [opts.urlExpirationSecond] - 指定下载链接的有效时间，单位秒,缺省为86400秒（即24小时） 取值范围：1-864000  optional
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        * @param string publicURL
        * @param string internalURL
        */
  
    describeBackupDownloadURL (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  describeBackupDownloadURL"
        )
      }
  
      opts = opts || {}
  
      if (opts.backupId === undefined || opts.backupId === null) {
        throw new Error(
          "Missing the required parameter 'opts.backupId' when calling describeBackupDownloadURL"
        )
      }
  
      let postBody = null
      let queryParams = {}
      if (opts.fileName !== undefined && opts.fileName !== null) {
        queryParams['fileName'] = opts.fileName
      }
      if (
        opts.urlExpirationSecond !== undefined &&
        opts.urlExpirationSecond !== null
      ) {
        queryParams['urlExpirationSecond'] = opts.urlExpirationSecond
      }
  
      let pathParams = {
        regionId: regionId,
        backupId: opts.backupId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call describeBackupDownloadURL with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/backups/{backupId}/downloadURLs',
        'GET',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  创建数据库
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {} opts.dbName - 数据库名称
        * @param {} opts.characterSetName - 字符集名称,mysql字符集包括：utf8；SQL Server字符集包括：Chinese_PRC_CI_AS、Chinese_PRC_CS_AS、SQL_Latin1_General_CP1_CI_AS、SQL_Latin1_General_CP1_CS_AS、Chinese_PRC_BIN
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    createDatabase (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  createDatabase"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling createDatabase"
        )
      }
      if (opts.dbName === undefined || opts.dbName === null) {
        throw new Error(
          "Missing the required parameter 'opts.dbName' when calling createDatabase"
        )
      }
      if (opts.characterSetName === undefined || opts.characterSetName === null) {
        throw new Error(
          "Missing the required parameter 'opts.characterSetName' when calling createDatabase"
        )
      }
  
      let postBody = {}
      if (opts.dbName !== undefined && opts.dbName !== null) {
        postBody['dbName'] = opts.dbName
      }
      if (opts.characterSetName !== undefined && opts.characterSetName !== null) {
        postBody['characterSetName'] = opts.characterSetName
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call createDatabase with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/databases',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  删除数据库
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.dbName - 库名称
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    deleteDatabase (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  deleteDatabase"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling deleteDatabase"
        )
      }
      if (opts.dbName === undefined || opts.dbName === null) {
        throw new Error(
          "Missing the required parameter 'opts.dbName' when calling deleteDatabase"
        )
      }
  
      let postBody = null
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        dbName: opts.dbName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call deleteDatabase with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/databases/{dbName}',
        'DELETE',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  从云数据库SQL Server备份中恢复单个数据库
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.dbName - 库名称
        * @param {} opts.backupId - 备份ID
        * @param {} opts.backupFileName - 指定该备份中用于恢复数据库的文件名称
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    restoreDatabaseFromBackup (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  restoreDatabaseFromBackup"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling restoreDatabaseFromBackup"
        )
      }
      if (opts.dbName === undefined || opts.dbName === null) {
        throw new Error(
          "Missing the required parameter 'opts.dbName' when calling restoreDatabaseFromBackup"
        )
      }
      if (opts.backupId === undefined || opts.backupId === null) {
        throw new Error(
          "Missing the required parameter 'opts.backupId' when calling restoreDatabaseFromBackup"
        )
      }
      if (opts.backupFileName === undefined || opts.backupFileName === null) {
        throw new Error(
          "Missing the required parameter 'opts.backupFileName' when calling restoreDatabaseFromBackup"
        )
      }
  
      let postBody = {}
      if (opts.backupId !== undefined && opts.backupId !== null) {
        postBody['backupId'] = opts.backupId
      }
      if (opts.backupFileName !== undefined && opts.backupFileName !== null) {
        postBody['backupFileName'] = opts.backupFileName
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        dbName: opts.dbName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call restoreDatabaseFromBackup with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/databases/{dbName}:restoreDatabaseFromBackup',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  从用户上传的备份文件中恢复SQL Server数据库
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} opts.dbName - 库名称
        * @param {} [opts.sharedFileGid] - 共享文件的全局ID，可从上传文件查询接口describeImportFiles获取；如果该文件不是共享文件，则全局ID为空  optional
        * @param {} opts.fileName - 用户在单库上云中上传的文件名称
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        */
  
    restoreDatabaseFromFile (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  restoreDatabaseFromFile"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling restoreDatabaseFromFile"
        )
      }
      if (opts.dbName === undefined || opts.dbName === null) {
        throw new Error(
          "Missing the required parameter 'opts.dbName' when calling restoreDatabaseFromFile"
        )
      }
      if (opts.fileName === undefined || opts.fileName === null) {
        throw new Error(
          "Missing the required parameter 'opts.fileName' when calling restoreDatabaseFromFile"
        )
      }
  
      let postBody = {}
      if (opts.sharedFileGid !== undefined && opts.sharedFileGid !== null) {
        postBody['sharedFileGid'] = opts.sharedFileGid
      }
      if (opts.fileName !== undefined && opts.fileName !== null) {
        postBody['fileName'] = opts.fileName
      }
  
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId,
        dbName: opts.dbName
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call restoreDatabaseFromFile with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/databases/{dbName}:restoreDatabaseFromFile',
        'POST',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  
    /**
        *  获取单库上云文件列表
        * @param {Object} opts - parameters
        * @param {string} opts.instanceId - 实例ID
        * @param {string} regionId - ID of the region
        * @param {string} callback - callback
        @return {Object} result
        * @param importFile importFiles
        */
  
    describeImportFiles (opts, regionId = this.config.regionId, callback) {
      if (typeof regionId === 'function') {
        callback = regionId
        regionId = this.config.regionId
      }
  
      if (regionId === undefined || regionId === null) {
        throw new Error(
          "Missing the required parameter 'regionId' when calling  describeImportFiles"
        )
      }
  
      opts = opts || {}
  
      if (opts.instanceId === undefined || opts.instanceId === null) {
        throw new Error(
          "Missing the required parameter 'opts.instanceId' when calling describeImportFiles"
        )
      }
  
      let postBody = null
      let queryParams = {}
  
      let pathParams = {
        regionId: regionId,
        instanceId: opts.instanceId
      }
  
      let headerParams = {
        'User-Agent': 'JdcloudSdkNode/1.0.0  rds/0.2.3'
      }
  
      let formParams = {}
  
      let contentTypes = ['application/json']
      let accepts = ['application/json']
  
      let returnType = null
  
      this.config.logger(
        `call describeImportFiles with params:\npathParams:${JSON.stringify(
          pathParams
        )},\nqueryParams:${JSON.stringify(
          queryParams
        )}, \nheaderParams:${JSON.stringify(
          headerParams
        )}, \nformParams:${JSON.stringify(
          formParams
        )}, \npostBody:${JSON.stringify(postBody)}`,
        'DEBUG'
      )
  
      let request = this.makeRequest(
        '/regions/{regionId}/instances/{instanceId}/importFiles',
        'GET',
        pathParams,
        queryParams,
        headerParams,
        formParams,
        postBody,
        contentTypes,
        accepts,
        returnType,
        callback
      )
  
      return request.then(
        function (result) {
          if (callback) {
            return callback(null, result)
          }
          return result
        },
        function (error) {
          if (callback) {
            return callback(error)
          }
          return Promise.reject(error)
        }
      )
    }
  }
  module.exports = JDCloud.RDS
  