Search in sources :

Example 56 with TencentCloudSDKException

use of com.tencentcloudapi.common.exception.TencentCloudSDKException in project tencentcloud-sdk-java-intl-en by TencentCloud.

the class CvmClient method InquiryPriceRunInstances.

/**
 *This API is used to query the price of creating instances. You can only use this API for instances whose configuration is within the purchase limit. For more information, see [RunInstances](https://intl.cloud.tencent.com/document/api/213/15730?from_cn_redirect=1).
 * @param req InquiryPriceRunInstancesRequest
 * @return InquiryPriceRunInstancesResponse
 * @throws TencentCloudSDKException
 */
public InquiryPriceRunInstancesResponse InquiryPriceRunInstances(InquiryPriceRunInstancesRequest req) throws TencentCloudSDKException {
    JsonResponseModel<InquiryPriceRunInstancesResponse> rsp = null;
    String rspStr = "";
    try {
        Type type = new TypeToken<JsonResponseModel<InquiryPriceRunInstancesResponse>>() {
        }.getType();
        rspStr = this.internalRequest(req, "InquiryPriceRunInstances");
        rsp = gson.fromJson(rspStr, type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
    }
    return rsp.response;
}
Also used : JsonResponseModel(com.tencentcloudapi.common.JsonResponseModel) Type(java.lang.reflect.Type) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 57 with TencentCloudSDKException

use of com.tencentcloudapi.common.exception.TencentCloudSDKException in project tencentcloud-sdk-java-intl-en by TencentCloud.

the class MariadbClient method ModifyDBParameters.

/**
 *This API is used to modify database parameters.
 * @param req ModifyDBParametersRequest
 * @return ModifyDBParametersResponse
 * @throws TencentCloudSDKException
 */
public ModifyDBParametersResponse ModifyDBParameters(ModifyDBParametersRequest req) throws TencentCloudSDKException {
    JsonResponseModel<ModifyDBParametersResponse> rsp = null;
    String rspStr = "";
    try {
        Type type = new TypeToken<JsonResponseModel<ModifyDBParametersResponse>>() {
        }.getType();
        rspStr = this.internalRequest(req, "ModifyDBParameters");
        rsp = gson.fromJson(rspStr, type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
    }
    return rsp.response;
}
Also used : JsonResponseModel(com.tencentcloudapi.common.JsonResponseModel) Type(java.lang.reflect.Type) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 58 with TencentCloudSDKException

use of com.tencentcloudapi.common.exception.TencentCloudSDKException in project tencentcloud-sdk-java-intl-en by TencentCloud.

the class MariadbClient method IsolateHourDBInstance.

/**
 *This API is used to isolate pay-as-you-go instances.
 * @param req IsolateHourDBInstanceRequest
 * @return IsolateHourDBInstanceResponse
 * @throws TencentCloudSDKException
 */
public IsolateHourDBInstanceResponse IsolateHourDBInstance(IsolateHourDBInstanceRequest req) throws TencentCloudSDKException {
    JsonResponseModel<IsolateHourDBInstanceResponse> rsp = null;
    String rspStr = "";
    try {
        Type type = new TypeToken<JsonResponseModel<IsolateHourDBInstanceResponse>>() {
        }.getType();
        rspStr = this.internalRequest(req, "IsolateHourDBInstance");
        rsp = gson.fromJson(rspStr, type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
    }
    return rsp.response;
}
Also used : JsonResponseModel(com.tencentcloudapi.common.JsonResponseModel) Type(java.lang.reflect.Type) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 59 with TencentCloudSDKException

use of com.tencentcloudapi.common.exception.TencentCloudSDKException in project tencentcloud-sdk-java-intl-en by TencentCloud.

the class MariadbClient method DescribeBackupTime.

/**
 *This API is used to get the backup time of a TencentDB instance. The backend system will perform instance backup regularly according to this configuration.
 * @param req DescribeBackupTimeRequest
 * @return DescribeBackupTimeResponse
 * @throws TencentCloudSDKException
 */
public DescribeBackupTimeResponse DescribeBackupTime(DescribeBackupTimeRequest req) throws TencentCloudSDKException {
    JsonResponseModel<DescribeBackupTimeResponse> rsp = null;
    String rspStr = "";
    try {
        Type type = new TypeToken<JsonResponseModel<DescribeBackupTimeResponse>>() {
        }.getType();
        rspStr = this.internalRequest(req, "DescribeBackupTime");
        rsp = gson.fromJson(rspStr, type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
    }
    return rsp.response;
}
Also used : JsonResponseModel(com.tencentcloudapi.common.JsonResponseModel) Type(java.lang.reflect.Type) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Example 60 with TencentCloudSDKException

use of com.tencentcloudapi.common.exception.TencentCloudSDKException in project tencentcloud-sdk-java-intl-en by TencentCloud.

the class MariadbClient method SwitchDBInstanceHA.

/**
 *This API is used to start a primary-replica switch of instances.
 * @param req SwitchDBInstanceHARequest
 * @return SwitchDBInstanceHAResponse
 * @throws TencentCloudSDKException
 */
public SwitchDBInstanceHAResponse SwitchDBInstanceHA(SwitchDBInstanceHARequest req) throws TencentCloudSDKException {
    JsonResponseModel<SwitchDBInstanceHAResponse> rsp = null;
    String rspStr = "";
    try {
        Type type = new TypeToken<JsonResponseModel<SwitchDBInstanceHAResponse>>() {
        }.getType();
        rspStr = this.internalRequest(req, "SwitchDBInstanceHA");
        rsp = gson.fromJson(rspStr, type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException("response message: " + rspStr + ".\n Error message: " + e.getMessage());
    }
    return rsp.response;
}
Also used : JsonResponseModel(com.tencentcloudapi.common.JsonResponseModel) Type(java.lang.reflect.Type) TencentCloudSDKException(com.tencentcloudapi.common.exception.TencentCloudSDKException) JsonSyntaxException(com.google.gson.JsonSyntaxException)

Aggregations

TencentCloudSDKException (com.tencentcloudapi.common.exception.TencentCloudSDKException)10463 JsonSyntaxException (com.google.gson.JsonSyntaxException)10379 Type (java.lang.reflect.Type)10377 JsonResponseModel (com.tencentcloudapi.common.JsonResponseModel)10373 Credential (com.tencentcloudapi.common.Credential)39 ClientProfile (com.tencentcloudapi.common.profile.ClientProfile)26 HttpProfile (com.tencentcloudapi.common.profile.HttpProfile)26 CloudSDKException (com.mizhousoft.cloudsdk.CloudSDKException)12 CvmClient (com.tencentcloudapi.cvm.v20170312.CvmClient)12 DescribeInstancesRequest (com.tencentcloudapi.cvm.v20170312.models.DescribeInstancesRequest)12 HashMap (java.util.HashMap)12 DescribeInstancesResponse (com.tencentcloudapi.cvm.v20170312.models.DescribeInstancesResponse)10 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)9 IOException (java.io.IOException)8 CommonClient (com.tencentcloudapi.common.CommonClient)7 Test (org.junit.Test)7 MediaType (com.squareup.okhttp.MediaType)6 Request (com.squareup.okhttp.Request)6 TciClient (com.tencentcloudapi.tci.v20190318.TciClient)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)6