动态加速接口
更新时间:2023-05-16
配置动态加速服务
Plain Text
1public void setDsaEnabled(){
2 SetDsaEnabledRequest request=new SetDsaEnabledRequest().withAction("enable");
3 CdnResponse response = cdnClient.setDsaEnabled(request);
4 System.out.println(response);
5 }
查询动态加速域名列表
Plain Text
1 public void getDsaDomains(){
2 GetDsaDomainsRequest request=new GetDsaDomainsRequest();
3 GetDsaDomainsResponse dsaDomains = cdnClient.getDsaDomains(request);
4 System.out.println(dsaDomains);
5 }
配置域名动态加速规则
Plain Text
1public void setDsaConfig(){
2 DSARule rule1=new DSARule().withType("suffix").withValue(".mp4;.jpg;.php");
3 DSARule rule2=new DSARule().withType("path").withValue("/path");
4 DSARule rule3=new DSARule().withType("exactPath").withValue("/path/to/file.mp4");
5 DSARule rule4=new DSARule().withType("method").withValue("GET;POST");
6 List<DSARule> rules=Arrays.asList(rule1,rule2,rule3,rule4);
7 Dsa dsa=new Dsa().withEnabled(true).withRules(rules).withComment("test");
8 String domain="vd3.bdstatic.com";
9 SetDsaConfigResponse response = cdnClient.setDsaConfig(domain, dsa);
10 System.out.println(response);
11 }