阅读84 返回首页    go 阿里云 go 技术社区[云栖]


查询流控记录__JAVA SDK_SDK 手册_CDN-阿里云

package com.aliyuncs.cdn.test;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.cdn.model.v20141111.DescribeLiveStreamsControlHistoryRequest;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.HttpResponse;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import org.junit.Test;

public class DescribeLiveStreamsControlHistoryTest {

    private IAcsClient client = null;

    public DescribeLiveStreamsControlHistoryTest() {
        if (null == client) {
            try {
                init();
            } catch (ClientException e) {
                e.printStackTrace();
            }
        }
    }

    public void init() throws ClientException {
//      初始化IAcsClient
        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "<your accessKey>", "<your accessSecret>");
        //DefaultProfile.addEndpoint("cn-hangzhou-2", "cn-hangzhou-2", "Cdn", "cdn.aliyuncs.com"); //添加自定义endpoint。
        client = new DefaultAcsClient(profile);
        //System.setProperty("http.proxyHost", "127.0.0.1"); //此设置用于设置代理,可用fiddler拦截查看http请求,便于调试。
        //System.setProperty("http.proxyPort", "8888");
    }

    @Test
    public void invoke() {
//      初始化请求
        DescribeLiveStreamsControlHistoryRequest describeLiveStreamsControlHistoryRequest = new DescribeLiveStreamsControlHistoryRequest();
        describeLiveStreamsControlHistoryRequest.setDomainName("test.cdnpe.com");
        describeLiveStreamsControlHistoryRequest.setAppName("testapp");
        describeLiveStreamsControlHistoryRequest.setStartTime("2015-10-01T00:00:00Z");
        describeLiveStreamsControlHistoryRequest.setEndTime("2015-10-01T20:00:00Z");

        try {
            HttpResponse httpResponse = client.doAction(describeLiveStreamsControlHistoryRequest);
            System.out.println(httpResponse.getUrl());
            System.out.println(new String(httpResponse.getContent()));

        } catch (ServerException e) {
            e.printStackTrace();
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}

最后更新:2016-11-24 11:23:47

  上一篇:go 获取域名日志__JAVA SDK_SDK 手册_CDN-阿里云
  下一篇:go 断流操作__JAVA SDK_SDK 手册_CDN-阿里云