package com.bocloud.cmp.provider.database;

import com.bocloud.cmp.model.database.DbInstanceDbModel;
import com.bocloud.cmp.model.database.DbInstanceModel;
import com.bocloud.cmp.model.database.DbInstanceParameterGroupModel;
import com.bocloud.cmp.model.database.DbInstanceUserModel;
import com.bocloud.cmp.provider.SuperProvider;
import com.bocloud.common.model.BocloudResult;

/**
 * 数据库操作驱动
 *
 * @author dmw
 */
public interface DatabaseProvider extends SuperProvider {
    /**
     * 同步所有的数据库实例信息
     *
     * @return
     */
    public BocloudResult listInstances();

    /**
     * 创建数据库实例
     *
     * @param instance
     * @return
     */
    public BocloudResult createInstance(DbInstanceModel instance);

    /**
     * 更新数据库配置信息
     *
     * @param instance
     * @return
     */
    public BocloudResult modifyInstance(DbInstanceModel instance);

    /**
     * 删除数据库实例
     *
     * @param instanceId
     * @return
     */
    public BocloudResult removeInstance(String instanceId);

    /**
     * 重启数据库实例
     *
     * @param instanceId
     * @return
     */
    public BocloudResult rebootInstance(String instanceId);

    /**
     * 获取数据库实例详情
     *
     * @param instanceId
     * @return
     */
    public BocloudResult instanceDetail(String instanceId);

    default BocloudResult getErrLog(DbInstanceModel dbInstanceModel) {
        return null;
    }

    default BocloudResult getSlowLog(DbInstanceModel dbInstanceModel) {
        return null;
    }

    default BocloudResult getFlavor(String chargeType) {
        return null;
    }

    default BocloudResult getRegions(String type, String volType) {
        return null;
    }

    default BocloudResult getParameterGroups(String regionId) {
        return null;
    }

    default BocloudResult createParameterGroups(String regionId, DbInstanceParameterGroupModel groupModel) {
        return null;
    }

    default BocloudResult modifyParameterGroups(String regionId, DbInstanceParameterGroupModel groupModel) {
        return null;
    }

    default BocloudResult deleteParameterGroups(String regionId, String groupId) {
        return null;
    }

    default BocloudResult cloneParameterGroups(String regionId, String targetRegionId, String groupId, String GroupName, String GroupDesc) {
        return null;
    }

    default BocloudResult restartDBInstance(String instanceId) {
        return null;
    }

    default BocloudResult createAccount(DbInstanceUserModel userModel) {
        return null;
    }

    default BocloudResult getAccount(String instanceId, String accountName) {
        return null;
    }

    default BocloudResult resetAccountPassword(String instanceId, String accountName, String accountPassword) {
        return null;
    }

    default BocloudResult deleteAccount(String instanceId, String accountName) {
        return null;
    }

    /**
     * 重置高权限账号的权限
     *
     * @param instanceId
     * @param accountName
     * @param accountPassword
     * @return
     */
    default BocloudResult resetAccount(String instanceId, String accountName, String accountPassword) {
        return null;
    }

    /**
     * 授权账号访问数据库
     *
     * @param instanceId
     * @param accountName
     * @param dbName
     * @param accountPrivilege
     * @return
     */
    default BocloudResult grantAccountPrivilege(String instanceId, String accountName, String dbName, String accountPrivilege) {
        return null;
    }

    /**
     * 撤销账号对数据库的访问权限
     *
     * @param instanceId
     * @param accountName
     * @param dbName
     * @return
     */
    default BocloudResult revokeAccountPrivilege(String instanceId, String accountName, String dbName) {
        return null;
    }

    default BocloudResult accounts(String instanceId, String accountName) {
        return null;
    }

    default BocloudResult dbs(String instanceId, String dbName) {
        return null;
    }

    default BocloudResult getDb(String instanceId, String dbName) {
        return null;
    }

    default BocloudResult createDatabase(DbInstanceDbModel dbModel) {
        return null;
    }

    default BocloudResult deleteDatabase(String instanceId, String dBName) {
        return null;
    }
}
