Java Code Examples for com.google.gson.JsonSyntaxException

The following examples show how to use com.google.gson.JsonSyntaxException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Galacticraft-Rewoven   Source File: ShapedCompressingRecipe.java    License: MIT License 6 votes vote down vote up
static String[] getPattern(JsonArray jsonArray_1) {
    String[] strings_1 = new String[jsonArray_1.size()];
    if (strings_1.length > 3) {
        throw new JsonSyntaxException("Invalid pattern: too many rows, 3 is maximum");
    } else if (strings_1.length == 0) {
        throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed");
    } else {
        for (int int_1 = 0; int_1 < strings_1.length; ++int_1) {
            String string_1 = JsonHelper.asString(jsonArray_1.get(int_1), "pattern[" + int_1 + "]");
            if (string_1.length() > 3) {
                throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum");
            }

            if (int_1 > 0 && strings_1[0].length() != string_1.length()) {
                throw new JsonSyntaxException("Invalid pattern: each row must be the same width");
            }

            strings_1[int_1] = string_1;
        }

        return strings_1;
    }
}
 
Example 2
Source Project: bender   Source File: KeyNameMutatorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testMutatePayload() throws JsonSyntaxException, IOException, OperationException {
  JsonParser parser = new JsonParser();
  JsonElement input = parser.parse(getResourceString("basic_input.json"));
  String expectedOutput = getResourceString("basic_output_key_name.json");

  DummpyEvent devent = new DummpyEvent();
  devent.payload = input.getAsJsonObject();

  KeyNameOperation operation = new KeyNameOperation();

  InternalEvent ievent = new InternalEvent("", null, 0);
  ievent.setEventObj(devent);
  operation.perform(ievent);

  assertEquals(expectedOutput, input.toString());
}
 
Example 3
Source Project: iBeebo   Source File: RepostNewMsgDao.java    License: GNU General Public License v3.0 6 votes vote down vote up
public MessageBean sendNewMsg() throws WeiboException {
    String url = WeiBoURLs.REPOST_CREATE;
    Map<String, String> map = new HashMap<String, String>();
    map.put("access_token", access_token);
    map.put("id", id);
    map.put("status", status);
    map.put("is_comment", is_comment);

    String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Post, url, map);

    Gson gson = new Gson();

    MessageBean value = null;
    try {
        value = gson.fromJson(jsonData, MessageBean.class);
    } catch (JsonSyntaxException e) {

        AppLoggerUtils.e(e.getMessage());
    }

    return value;

}
 
Example 4
Source Project: bender   Source File: GelfOperationTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testFlattenPrefix()
    throws JsonSyntaxException, UnsupportedEncodingException, IOException {
  JsonParser parser = new JsonParser();

  JsonElement input = parser.parse(getResourceString("flatten_prefixed_input.json"));
  String expectedOutput = getResourceString("flatten_prefixed_output.json");

  DummpyEvent devent = new DummpyEvent();
  devent.payload = input.getAsJsonObject();

  GelfOperation op = new GelfOperation(new ArrayList<>());

  InternalEvent ievent = new InternalEvent("", null, 0);
  ievent.setEventObj(devent);
  op.perform(ievent);

  assertEquals(parser.parse(expectedOutput), devent.payload);
}
 
Example 5
Source Project: trimou   Source File: JsonElementResolverTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testUnwrapJsonArray()
        throws JsonIOException, JsonSyntaxException, FileNotFoundException {

    MustacheEngine engine = getEngine();
    assertEquals("Jim,true,5",
            engine.compileMustache("json_unwrap_array_element_test",
                    "{{#aliases}}{{unwrapThis}}{{#iterHasNext}},{{/iterHasNext}}{{/aliases}}")
                    .render(loadJsonData()));
    assertEquals("Jim,true,5",
            engine.compileMustache("json_unwrap_array_element_test2",
                    "{{#this}}{{unwrapThis}}{{#iterHasNext}},{{/iterHasNext}}{{/this}}")
                    .render(loadJsonData("data_array.json")));
}
 
Example 6
Source Project: tencentcloud-sdk-java   Source File: IotClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *获取转发规则信息
 * @param req GetRuleRequest
 * @return GetRuleResponse
 * @throws TencentCloudSDKException
 */
public GetRuleResponse GetRule(GetRuleRequest req) throws TencentCloudSDKException{
    JsonResponseModel<GetRuleResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<GetRuleResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "GetRule"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 7
Source Project: tencentcloud-sdk-java   Source File: EcmClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *只有状态为RUNNING的实例才可以进行此操作;接口调用成功时,实例会进入REBOOTING状态;重启实例成功时,实例会进入RUNNING状态;支持强制重启,强制重启的效果等同于关闭物理计算机的电源开关再重新启动。强制重启可能会导致数据丢失或文件系统损坏,请仅在服务器不能正常重启时使用。
 * @param req RebootInstancesRequest
 * @return RebootInstancesResponse
 * @throws TencentCloudSDKException
 */
public RebootInstancesResponse RebootInstances(RebootInstancesRequest req) throws TencentCloudSDKException{
    JsonResponseModel<RebootInstancesResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<RebootInstancesResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "RebootInstances"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 8
Source Project: tencentcloud-sdk-java   Source File: IotClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *获取转发规则列表
 * @param req GetRulesRequest
 * @return GetRulesResponse
 * @throws TencentCloudSDKException
 */
public GetRulesResponse GetRules(GetRulesRequest req) throws TencentCloudSDKException{
    JsonResponseModel<GetRulesResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<GetRulesResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "GetRules"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 9
Source Project: tencentcloud-sdk-java   Source File: DcdbClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *本接口(DescribeSqlLogs)用于获取实例SQL日志。
 * @param req DescribeSqlLogsRequest
 * @return DescribeSqlLogsResponse
 * @throws TencentCloudSDKException
 */
public DescribeSqlLogsResponse DescribeSqlLogs(DescribeSqlLogsRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeSqlLogsResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeSqlLogsResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeSqlLogs"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 10
Source Project: tencentcloud-sdk-java   Source File: CdbClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *本接口(IsolateDBInstance)用于隔离云数据库实例,隔离后不能通过IP和端口访问数据库。隔离的实例可在回收站中进行开机。若为欠费隔离,请尽快进行充值。
 * @param req IsolateDBInstanceRequest
 * @return IsolateDBInstanceResponse
 * @throws TencentCloudSDKException
 */
public IsolateDBInstanceResponse IsolateDBInstance(IsolateDBInstanceRequest req) throws TencentCloudSDKException{
    JsonResponseModel<IsolateDBInstanceResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<IsolateDBInstanceResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "IsolateDBInstance"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 11
Source Project: tencentcloud-sdk-java   Source File: ScfClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *该接口用于获取函数代码包的下载地址。
 * @param req GetFunctionAddressRequest
 * @return GetFunctionAddressResponse
 * @throws TencentCloudSDKException
 */
public GetFunctionAddressResponse GetFunctionAddress(GetFunctionAddressRequest req) throws TencentCloudSDKException{
    JsonResponseModel<GetFunctionAddressResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<GetFunctionAddressResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "GetFunctionAddress"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 12
Source Project: tencentcloud-sdk-java   Source File: TciClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *获取标准化接口任务结果
 * @param req DescribeAITaskResultRequest
 * @return DescribeAITaskResultResponse
 * @throws TencentCloudSDKException
 */
public DescribeAITaskResultResponse DescribeAITaskResult(DescribeAITaskResultRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeAITaskResultResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeAITaskResultResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeAITaskResult"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 13
Source Project: tencentcloud-sdk-java   Source File: CbsClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
     *本接口(CreateAutoSnapshotPolicy)用于创建定期快照策略。

* 每个地域可创建的定期快照策略数量限制请参考文档[定期快照](/document/product/362/8191)。
* 每个地域可创建的快照有数量和容量的限制,具体请见腾讯云控制台快照页面提示,如果快照超配额,定期快照创建会失败。
     * @param req CreateAutoSnapshotPolicyRequest
     * @return CreateAutoSnapshotPolicyResponse
     * @throws TencentCloudSDKException
     */
    public CreateAutoSnapshotPolicyResponse CreateAutoSnapshotPolicy(CreateAutoSnapshotPolicyRequest req) throws TencentCloudSDKException{
        JsonResponseModel<CreateAutoSnapshotPolicyResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<CreateAutoSnapshotPolicyResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "CreateAutoSnapshotPolicy"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example 14
Source Project: MantaroBot   Source File: Character.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onStart(GameLobby lobby) {
    final I18nContext languageContext = lobby.getLanguageContext();
    try {
        GameStatsManager.log(name());
        AnimeGameData data = GsonDataManager.GSON_PRETTY.fromJson(APIUtils.getFrom("/mantaroapi/bot/character"), AnimeGameData.class);

        GameStatsManager.log(name());
        characterNameL = new ArrayList<>();
        characterName = data.getName();
        String imageUrl = data.getImage();

        //Allow for replying with only the first name of the character.
        if (characterName.contains(" ")) {
            characterNameL.add(characterName.split(" ")[0]);
        }

        characterNameL.add(characterName);
        sendEmbedImage(lobby.getChannel(), imageUrl, eb -> eb
                .setTitle(languageContext.get("commands.game.character_start"), null)
                .setFooter(languageContext.get("commands.game.end_footer"), null)
        ).queue(success -> lobby.setGameLoaded(true));
        return true;
    } catch (JsonSyntaxException ex) {
        lobby.getChannel().sendMessageFormat(languageContext.get("commands.game.character_load_error"), EmoteReference.WARNING, characterName).queue();
        return false;
    } catch (Exception e) {
        lobby.getChannel().sendMessageFormat(languageContext.get("commands.game.error"), EmoteReference.ERROR).queue();
        log.warn("Exception while setting up a game", e);
        return false;
    }
}
 
Example 15
Source Project: tencentcloud-sdk-java   Source File: BmeipClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *UnbindHosted接口用于解绑托管机器上的EIP
 * @param req UnbindHostedRequest
 * @return UnbindHostedResponse
 * @throws TencentCloudSDKException
 */
public UnbindHostedResponse UnbindHosted(UnbindHostedRequest req) throws TencentCloudSDKException{
    JsonResponseModel<UnbindHostedResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<UnbindHostedResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "UnbindHosted"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 16
public static CommentTimeLineData getCommentLineMsgList(String accountId) {
    TimeLinePosition position = getPosition(accountId);

    int limit = position.position + AppConfig.DB_CACHE_COUNT_OFFSET > AppConfig.DEFAULT_MSG_COUNT_50 ? position.position
            + AppConfig.DB_CACHE_COUNT_OFFSET
            : AppConfig.DEFAULT_MSG_COUNT_50;

    CommentListBean result = new CommentListBean();

    List<CommentBean> msgList = new ArrayList<CommentBean>();
    String sql = "select * from " + CommentsTable.CommentsDataTable.TABLE_NAME + " where "
            + CommentsTable.CommentsDataTable.ACCOUNTID + "  = " + accountId
            + " order by " + CommentsTable.CommentsDataTable.MBLOGID + " desc limit " + limit;
    Cursor c = getRsd().rawQuery(sql, null);
    Gson gson = new Gson();
    while (c.moveToNext()) {
        String json = c.getString(c.getColumnIndex(CommentsTable.CommentsDataTable.JSONDATA));
        if (!TextUtils.isEmpty(json)) {
            try {
                CommentBean value = gson.fromJson(json, CommentBean.class);
                value.getListViewSpannableString();
                msgList.add(value);
            } catch (JsonSyntaxException e) {
                AppLoggerUtils.e(e.getMessage());
            }
        } else {
            msgList.add(null);
        }
    }

    result.setComments(msgList);
    c.close();
    return new CommentTimeLineData(result, position);

}
 
Example 17
Source Project: tencentcloud-sdk-java   Source File: AsrClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
     *本接口用于对60秒之内的短音频文件进行识别。
<br>•   支持中文普通话、英语、粤语。
<br>•   支持本地语音文件上传和语音URL上传两种请求方式。
<br>•   音频格式支持wav、mp3;采样率支持8000Hz或者16000Hz;采样精度支持16bits;声道支持单声道。
<br>•   当音频文件通过请求中body内容上传时,请求大小不能超过600KB;当音频以URL方式传输时,音频时长不可超过60s。
<br>•   所有请求参数放在POST请求的body中,编码类型采用x-www-form-urlencoded,参数进行urlencode编码后传输。
     * @param req SentenceRecognitionRequest
     * @return SentenceRecognitionResponse
     * @throws TencentCloudSDKException
     */
    public SentenceRecognitionResponse SentenceRecognition(SentenceRecognitionRequest req) throws TencentCloudSDKException{
        JsonResponseModel<SentenceRecognitionResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<SentenceRecognitionResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "SentenceRecognition"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example 18
public static MentionTimeLineData getRepostLineMsgList(String accountId) {
    TimeLinePosition position = getPosition(accountId);

    Gson gson = new Gson();
    MessageListBean result = new MessageListBean();

    int limit = position.position + AppConfig.DB_CACHE_COUNT_OFFSET > AppConfig.DEFAULT_MSG_COUNT_50 ? position.position
            + AppConfig.DB_CACHE_COUNT_OFFSET
            : AppConfig.DEFAULT_MSG_COUNT_50;

    List<MessageBean> msgList = new ArrayList<MessageBean>();
    String sql = "select * from " + RepostsTable.RepostDataTable.TABLE_NAME + " where "
            + RepostsTable.RepostDataTable.ACCOUNTID + "  = " + accountId
            + " order by " + RepostsTable.RepostDataTable.MBLOGID + " desc limit " + limit;
    Cursor c = getRsd().rawQuery(sql, null);
    while (c.moveToNext()) {
        String json = c.getString(c.getColumnIndex(RepostsTable.RepostDataTable.JSONDATA));
        if (!TextUtils.isEmpty(json)) {
            try {
                MessageBean value = gson.fromJson(json, MessageBean.class);
                value.getListViewSpannableString();
                msgList.add(value);
            } catch (JsonSyntaxException e) {
                AppLoggerUtils.e(e.getMessage());
            }
        } else {
            msgList.add(null);
        }

    }

    result.setStatuses(msgList);
    c.close();
    MentionTimeLineData mentionTimeLineData = new MentionTimeLineData(result, position);

    return mentionTimeLineData;

}
 
Example 19
Source Project: tencentcloud-sdk-java   Source File: DcdbClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
     *本接口(DescribeAccountPrivileges)用于查询云数据库账号权限。
注意:注意:相同用户名,不同Host是不同的账号。
     * @param req DescribeAccountPrivilegesRequest
     * @return DescribeAccountPrivilegesResponse
     * @throws TencentCloudSDKException
     */
    public DescribeAccountPrivilegesResponse DescribeAccountPrivileges(DescribeAccountPrivilegesRequest req) throws TencentCloudSDKException{
        JsonResponseModel<DescribeAccountPrivilegesResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<DescribeAccountPrivilegesResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "DescribeAccountPrivileges"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example 20
Source Project: tencentcloud-sdk-java   Source File: TiiaClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
     *评估输入图片在视觉上的质量,从多个方面评估,并同时给出综合的、客观的清晰度评分,和主观的美观度评分。
>     
- 公共参数中的签名方式必须指定为V3版本,即配置SignatureMethod参数为TC3-HMAC-SHA256。
     * @param req AssessQualityRequest
     * @return AssessQualityResponse
     * @throws TencentCloudSDKException
     */
    public AssessQualityResponse AssessQuality(AssessQualityRequest req) throws TencentCloudSDKException{
        JsonResponseModel<AssessQualityResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<AssessQualityResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "AssessQuality"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example 21
private Integer getErrorCount(String responseJson) {
    try {
        final Map res = new Gson().fromJson(responseJson, Map.class);
        if (res != null) {
            final Object errors = res.get("errors");
            if (errors instanceof Collection) {
                return ((Collection) errors).size();
            }
            return 0;
        }
    } catch (JsonSyntaxException ignored) {
    }
    return null;
}
 
Example 22
Source Project: tencentcloud-sdk-java   Source File: TiemsClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *更新资源组的伸缩组
 * @param req UpdateRsgAsGroupRequest
 * @return UpdateRsgAsGroupResponse
 * @throws TencentCloudSDKException
 */
public UpdateRsgAsGroupResponse UpdateRsgAsGroup(UpdateRsgAsGroupRequest req) throws TencentCloudSDKException{
    JsonResponseModel<UpdateRsgAsGroupResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<UpdateRsgAsGroupResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "UpdateRsgAsGroup"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 23
Source Project: tencentcloud-sdk-java   Source File: CbsClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
     *本接口(TerminateDisks)用于退还云硬盘。

* 不再使用的云盘,可通过本接口主动退还。
* 本接口支持退还预付费云盘和按小时后付费云盘。按小时后付费云盘可直接退还,预付费云盘需符合退还规则。
* 支持批量操作,每次请求批量云硬盘的上限为50。如果批量云盘存在不允许操作的,请求会以特定错误码返回。
     * @param req TerminateDisksRequest
     * @return TerminateDisksResponse
     * @throws TencentCloudSDKException
     */
    public TerminateDisksResponse TerminateDisks(TerminateDisksRequest req) throws TencentCloudSDKException{
        JsonResponseModel<TerminateDisksResponse> rsp = null;
        try {
                Type type = new TypeToken<JsonResponseModel<TerminateDisksResponse>>() {
                }.getType();
                rsp  = gson.fromJson(this.internalRequest(req, "TerminateDisks"), type);
        } catch (JsonSyntaxException e) {
            throw new TencentCloudSDKException(e.getMessage());
        }
        return rsp.response;
    }
 
Example 24
Source Project: tencentcloud-sdk-java   Source File: TioneClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *查询Notebook实例详情
 * @param req DescribeNotebookInstanceRequest
 * @return DescribeNotebookInstanceResponse
 * @throws TencentCloudSDKException
 */
public DescribeNotebookInstanceResponse DescribeNotebookInstance(DescribeNotebookInstanceRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeNotebookInstanceResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeNotebookInstanceResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeNotebookInstance"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 25
Source Project: tencentcloud-sdk-java   Source File: BmClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *修改服务器名称
 * @param req ModifyDeviceAliasesRequest
 * @return ModifyDeviceAliasesResponse
 * @throws TencentCloudSDKException
 */
public ModifyDeviceAliasesResponse ModifyDeviceAliases(ModifyDeviceAliasesRequest req) throws TencentCloudSDKException{
    JsonResponseModel<ModifyDeviceAliasesResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<ModifyDeviceAliasesResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "ModifyDeviceAliases"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 26
Source Project: tencentcloud-sdk-java   Source File: GaapClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *该接口(DescribeUDPListeners)用于查询单通道或者通道组下的UDP监听器信息
 * @param req DescribeUDPListenersRequest
 * @return DescribeUDPListenersResponse
 * @throws TencentCloudSDKException
 */
public DescribeUDPListenersResponse DescribeUDPListeners(DescribeUDPListenersRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeUDPListenersResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeUDPListenersResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeUDPListeners"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 27
Source Project: tencentcloud-sdk-java   Source File: BmvpcClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *可用于将子网的部分IP绑定到NAT网关
 * @param req BindIpsToNatGatewayRequest
 * @return BindIpsToNatGatewayResponse
 * @throws TencentCloudSDKException
 */
public BindIpsToNatGatewayResponse BindIpsToNatGateway(BindIpsToNatGatewayRequest req) throws TencentCloudSDKException{
    JsonResponseModel<BindIpsToNatGatewayResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<BindIpsToNatGatewayResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "BindIpsToNatGateway"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 28
Source Project: tencentcloud-sdk-java   Source File: IottidClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *查询指定订单的可空发的白盒密钥数量
 * @param req DescribeAvailableLibCountRequest
 * @return DescribeAvailableLibCountResponse
 * @throws TencentCloudSDKException
 */
public DescribeAvailableLibCountResponse DescribeAvailableLibCount(DescribeAvailableLibCountRequest req) throws TencentCloudSDKException{
    JsonResponseModel<DescribeAvailableLibCountResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<DescribeAvailableLibCountResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "DescribeAvailableLibCount"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 29
Source Project: tencentcloud-sdk-java   Source File: KmsClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *获取导入主密钥(CMK)材料的参数,返回的Token作为执行ImportKeyMaterial的参数之一,返回的PublicKey用于对自主导入密钥材料进行加密。返回的Token和PublicKey 24小时后失效,失效后如需重新导入,需要再次调用该接口获取新的Token和PublicKey。
 * @param req GetParametersForImportRequest
 * @return GetParametersForImportResponse
 * @throws TencentCloudSDKException
 */
public GetParametersForImportResponse GetParametersForImport(GetParametersForImportRequest req) throws TencentCloudSDKException{
    JsonResponseModel<GetParametersForImportResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<GetParametersForImportResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "GetParametersForImport"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}
 
Example 30
Source Project: tencentcloud-sdk-java   Source File: YunjingClient.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *切换高危命令规则状态
 * @param req SwitchBashRulesRequest
 * @return SwitchBashRulesResponse
 * @throws TencentCloudSDKException
 */
public SwitchBashRulesResponse SwitchBashRules(SwitchBashRulesRequest req) throws TencentCloudSDKException{
    JsonResponseModel<SwitchBashRulesResponse> rsp = null;
    try {
            Type type = new TypeToken<JsonResponseModel<SwitchBashRulesResponse>>() {
            }.getType();
            rsp  = gson.fromJson(this.internalRequest(req, "SwitchBashRules"), type);
    } catch (JsonSyntaxException e) {
        throw new TencentCloudSDKException(e.getMessage());
    }
    return rsp.response;
}