com.tencentcloudapi.mongodb.v20190725.MongodbClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tencentcloud-sdk-java-mongodb Show documentation
Show all versions of tencentcloud-sdk-java-mongodb Show documentation
Tencent Cloud Open API SDK for Java
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* 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.
*/
package com.tencentcloudapi.mongodb.v20190725;
import java.lang.reflect.Type;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.AbstractClient;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.JsonResponseModel;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.mongodb.v20190725.models.*;
public class MongodbClient extends AbstractClient{
private static String endpoint = "mongodb.tencentcloudapi.com";
private static String service = "mongodb";
private static String version = "2019-07-25";
public MongodbClient(Credential credential, String region) {
this(credential, region, new ClientProfile());
}
public MongodbClient(Credential credential, String region, ClientProfile profile) {
super(MongodbClient.endpoint, MongodbClient.version, credential, region, profile);
}
/**
*本接口(AssignProject)用于指定云数据库实例的所属项目。
* @param req AssignProjectRequest
* @return AssignProjectResponse
* @throws TencentCloudSDKException
*/
public AssignProjectResponse AssignProject(AssignProjectRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "AssignProject");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*备份实例接口
* @param req CreateBackupDBInstanceRequest
* @return CreateBackupDBInstanceResponse
* @throws TencentCloudSDKException
*/
public CreateBackupDBInstanceResponse CreateBackupDBInstance(CreateBackupDBInstanceRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CreateBackupDBInstance");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口用来创建某个备份文件的下载任务
* @param req CreateBackupDownloadTaskRequest
* @return CreateBackupDownloadTaskResponse
* @throws TencentCloudSDKException
*/
public CreateBackupDownloadTaskResponse CreateBackupDownloadTask(CreateBackupDownloadTaskRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CreateBackupDownloadTask");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(CreateDBInstance)用于创建包年包月的MongoDB云数据库实例。接口支持的售卖规格,可从查询云数据库的售卖规格(DescribeSpecInfo)获取。
* @param req CreateDBInstanceRequest
* @return CreateDBInstanceResponse
* @throws TencentCloudSDKException
*/
public CreateDBInstanceResponse CreateDBInstance(CreateDBInstanceRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CreateDBInstance");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(CreateDBInstanceHour)用于创建按量计费的MongoDB云数据库实例。
* @param req CreateDBInstanceHourRequest
* @return CreateDBInstanceHourResponse
* @throws TencentCloudSDKException
*/
public CreateDBInstanceHourResponse CreateDBInstanceHour(CreateDBInstanceHourRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "CreateDBInstanceHour");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*查询异步任务状态接口
* @param req DescribeAsyncRequestInfoRequest
* @return DescribeAsyncRequestInfoResponse
* @throws TencentCloudSDKException
*/
public DescribeAsyncRequestInfoResponse DescribeAsyncRequestInfo(DescribeAsyncRequestInfoRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeAsyncRequestInfo");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*备份下载功能已调整,此接口即将下线
本接口(DescribeBackupAccess)用于获取备份文件的下载授权,具体的备份文件信息可通过查询实例备份列表(DescribeDBBackups)接口获取
* @param req DescribeBackupAccessRequest
* @return DescribeBackupAccessResponse
* @throws TencentCloudSDKException
*/
public DescribeBackupAccessResponse DescribeBackupAccess(DescribeBackupAccessRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeBackupAccess");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*查询备份下载任务信息
* @param req DescribeBackupDownloadTaskRequest
* @return DescribeBackupDownloadTaskResponse
* @throws TencentCloudSDKException
*/
public DescribeBackupDownloadTaskResponse DescribeBackupDownloadTask(DescribeBackupDownloadTaskRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeBackupDownloadTask");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeClientConnections)用于查询实例客户端连接信息,包括连接IP和连接数量。
* @param req DescribeClientConnectionsRequest
* @return DescribeClientConnectionsResponse
* @throws TencentCloudSDKException
*/
public DescribeClientConnectionsResponse DescribeClientConnections(DescribeClientConnectionsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeClientConnections");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeCurrentOp)用于查询MongoDB云数据库实例的当前正在执行的操作。
* @param req DescribeCurrentOpRequest
* @return DescribeCurrentOpResponse
* @throws TencentCloudSDKException
*/
public DescribeCurrentOpResponse DescribeCurrentOp(DescribeCurrentOpRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeCurrentOp");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeDBBackups)用于查询实例备份列表,目前只支持查询7天内的备份记录。
* @param req DescribeDBBackupsRequest
* @return DescribeDBBackupsResponse
* @throws TencentCloudSDKException
*/
public DescribeDBBackupsResponse DescribeDBBackups(DescribeDBBackupsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeDBBackups");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeDBInstanceDeal)用于获取MongoDB购买、续费及变配订单详细。
* @param req DescribeDBInstanceDealRequest
* @return DescribeDBInstanceDealResponse
* @throws TencentCloudSDKException
*/
public DescribeDBInstanceDealResponse DescribeDBInstanceDeal(DescribeDBInstanceDealRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeDBInstanceDeal");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeDBInstances)用于查询云数据库实例列表,支持通过项目ID、实例ID、实例状态等过滤条件来筛选实例。支持查询主实例、灾备实例和只读实例信息列表。
* @param req DescribeDBInstancesRequest
* @return DescribeDBInstancesResponse
* @throws TencentCloudSDKException
*/
public DescribeDBInstancesResponse DescribeDBInstances(DescribeDBInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeDBInstances");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeInstanceParams)用于查询当前实例可修改的参数列表。
* @param req DescribeInstanceParamsRequest
* @return DescribeInstanceParamsResponse
* @throws TencentCloudSDKException
*/
public DescribeInstanceParamsResponse DescribeInstanceParams(DescribeInstanceParamsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeInstanceParams");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*查询实例绑定的安全组
* @param req DescribeSecurityGroupRequest
* @return DescribeSecurityGroupResponse
* @throws TencentCloudSDKException
*/
public DescribeSecurityGroupResponse DescribeSecurityGroup(DescribeSecurityGroupRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeSecurityGroup");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeSlowLogPatterns)用于获取数据库实例慢日志的统计信息。
* @param req DescribeSlowLogPatternsRequest
* @return DescribeSlowLogPatternsResponse
* @throws TencentCloudSDKException
*/
public DescribeSlowLogPatternsResponse DescribeSlowLogPatterns(DescribeSlowLogPatternsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeSlowLogPatterns");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeSlowLogs)用于获取云数据库慢日志信息。接口只支持查询最近7天内慢日志。
* @param req DescribeSlowLogsRequest
* @return DescribeSlowLogsResponse
* @throws TencentCloudSDKException
*/
public DescribeSlowLogsResponse DescribeSlowLogs(DescribeSlowLogsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeSlowLogs");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(DescribeSpecInfo)用于查询实例的售卖规格。
* @param req DescribeSpecInfoRequest
* @return DescribeSpecInfoResponse
* @throws TencentCloudSDKException
*/
public DescribeSpecInfoResponse DescribeSpecInfo(DescribeSpecInfoRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "DescribeSpecInfo");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*在所有mongos上执行FlushRouterConfig命令
* @param req FlushInstanceRouterConfigRequest
* @return FlushInstanceRouterConfigResponse
* @throws TencentCloudSDKException
*/
public FlushInstanceRouterConfigResponse FlushInstanceRouterConfig(FlushInstanceRouterConfigRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "FlushInstanceRouterConfig");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口用于创建数据库实例询价。本接口参数中必须传入region参数,否则无法通过校验。本接口仅允许针对购买限制范围内的实例配置进行询价。
* @param req InquirePriceCreateDBInstancesRequest
* @return InquirePriceCreateDBInstancesResponse
* @throws TencentCloudSDKException
*/
public InquirePriceCreateDBInstancesResponse InquirePriceCreateDBInstances(InquirePriceCreateDBInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "InquirePriceCreateDBInstances");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口 (InquirePriceModifyDBInstanceSpec) 用于调整实例的配置询价。
* @param req InquirePriceModifyDBInstanceSpecRequest
* @return InquirePriceModifyDBInstanceSpecResponse
* @throws TencentCloudSDKException
*/
public InquirePriceModifyDBInstanceSpecResponse InquirePriceModifyDBInstanceSpec(InquirePriceModifyDBInstanceSpecRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "InquirePriceModifyDBInstanceSpec");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口 (InquiryPriceRenewDBInstances) 用于续费包年包月实例询价。
* @param req InquirePriceRenewDBInstancesRequest
* @return InquirePriceRenewDBInstancesResponse
* @throws TencentCloudSDKException
*/
public InquirePriceRenewDBInstancesResponse InquirePriceRenewDBInstances(InquirePriceRenewDBInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "InquirePriceRenewDBInstances");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(IsolateDBInstance)用于隔离MongoDB云数据库按量计费实例。隔离后实例保留在回收站中,不能再写入数据。隔离一定时间后,实例会彻底删除,回收站保存时间请参考按量计费的服务条款。在隔离中的按量计费实例无法恢复,请谨慎操作。
* @param req IsolateDBInstanceRequest
* @return IsolateDBInstanceResponse
* @throws TencentCloudSDKException
*/
public IsolateDBInstanceResponse IsolateDBInstance(IsolateDBInstanceRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "IsolateDBInstance");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(KillOps)用于终止MongoDB云数据库实例上执行的特定操作。
* @param req KillOpsRequest
* @return KillOpsResponse
* @throws TencentCloudSDKException
*/
public KillOpsResponse KillOps(KillOpsRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "KillOps");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(ModifyDBInstanceSpec)用于调整MongoDB云数据库实例配置。接口支持的售卖规格,可从查询云数据库的售卖规格(DescribeSpecInfo)获取。
* @param req ModifyDBInstanceSpecRequest
* @return ModifyDBInstanceSpecResponse
* @throws TencentCloudSDKException
*/
public ModifyDBInstanceSpecResponse ModifyDBInstanceSpec(ModifyDBInstanceSpecRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "ModifyDBInstanceSpec");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(OfflineIsolatedDBInstance)用于立即下线隔离状态的云数据库实例。进行操作的实例状态必须为隔离状态。
* @param req OfflineIsolatedDBInstanceRequest
* @return OfflineIsolatedDBInstanceResponse
* @throws TencentCloudSDKException
*/
public OfflineIsolatedDBInstanceResponse OfflineIsolatedDBInstance(OfflineIsolatedDBInstanceRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "OfflineIsolatedDBInstance");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(RenameInstance)用于修改云数据库实例的名称。
* @param req RenameInstanceRequest
* @return RenameInstanceResponse
* @throws TencentCloudSDKException
*/
public RenameInstanceResponse RenameInstance(RenameInstanceRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "RenameInstance");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*本接口(RenewDBInstance)用于续费云数据库实例,仅支持付费模式为包年包月的实例。按量计费实例不需要续费。
* @param req RenewDBInstancesRequest
* @return RenewDBInstancesResponse
* @throws TencentCloudSDKException
*/
public RenewDBInstancesResponse RenewDBInstances(RenewDBInstancesRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "RenewDBInstances");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
/**
*修改实例用户的密码
* @param req ResetDBInstancePasswordRequest
* @return ResetDBInstancePasswordResponse
* @throws TencentCloudSDKException
*/
public ResetDBInstancePasswordResponse ResetDBInstancePassword(ResetDBInstancePasswordRequest req) throws TencentCloudSDKException{
JsonResponseModel rsp = null;
String rspStr = "";
try {
Type type = new TypeToken>() {
}.getType();
rspStr = this.internalRequest(req, "ResetDBInstancePassword");
rsp = gson.fromJson(rspStr, type);
} catch (JsonSyntaxException e) {
throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
}
return rsp.response;
}
}