Search in sources :

Example 1 with MediaQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class QueueDemo method updateMediaQueue.

/**
 * UpdateMediaQueue 接口用于更新队列
 * Request中 Name,QueueID,State,NotifyConfig 为必填字段
 * @param client
 */
public static void updateMediaQueue(COSClient client) {
    // 1.创建队列请求对象
    MediaQueueRequest request = new MediaQueueRequest();
    // 2.添加请求参数 参数详情请见api接口文档
    request.setBucketName("DemoBucket-123456789");
    request.setQueueId("p9900025e4ec44b5e8225e70a521*****");
    request.getNotifyConfig().setUrl("cloud.tencent.com");
    request.setState("Active");
    request.setName("queue-2");
    // 3.调用接口,获取队列响应对象
    MediaQueueResponse response = client.updateMediaQueue(request);
    System.out.println(response);
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaQueueResponse)

Example 2 with MediaQueueResponse

use of com.qcloud.cos.model.ciModel.queue.MediaQueueResponse in project cos-java-sdk-v5 by tencentyun.

the class MediaQueueTest method updateMediaQueueTest.

@Test
public void updateMediaQueueTest() {
    if (!judgeUserInfoValid()) {
        return;
    }
    MediaQueueRequest request = new MediaQueueRequest();
    request.setBucketName(bucket);
    MediaListQueueResponse response = cosclient.describeMediaQueues(request);
    if (response != null) {
        List<MediaQueueObject> queueList = response.getQueueList();
        if (queueList.size() != 0) {
            MediaQueueObject mediaQueueObject = queueList.get(0);
            request = new MediaQueueRequest();
            request.setBucketName(bucket);
            request.setQueueId(mediaQueueObject.getQueueId());
            request.getNotifyConfig().setUrl(QUEUE_URL);
            request.setState(QUEUE_STATE);
            request.setName(QUEUE_NAME);
            MediaQueueResponse updateResponse = cosclient.updateMediaQueue(request);
            MediaQueueObject queue = updateResponse.getQueue();
            assertEquals(bucket, queue.getBucketId());
            assertEquals(QUEUE_NAME, queue.getName());
            assertEquals(QUEUE_STATE, queue.getState());
        }
    }
}
Also used : MediaQueueRequest(com.qcloud.cos.model.ciModel.queue.MediaQueueRequest) MediaQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaQueueResponse) MediaListQueueResponse(com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse) MediaQueueObject(com.qcloud.cos.model.ciModel.queue.MediaQueueObject) Test(org.junit.Test)

Aggregations

MediaQueueRequest (com.qcloud.cos.model.ciModel.queue.MediaQueueRequest)2 MediaQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaQueueResponse)2 MediaListQueueResponse (com.qcloud.cos.model.ciModel.queue.MediaListQueueResponse)1 MediaQueueObject (com.qcloud.cos.model.ciModel.queue.MediaQueueObject)1 Test (org.junit.Test)1