Access Configuration Interface
Last Updated:2020-09-17
Set Referer Access Control
public void testSetDomainRefererACL() {
RefererACL acl = new RefererACL()
.addBlackList("http://a.com")
.addBlackList("http://b.com");
SetDomainRefererACLRequest request = new SetDomainRefererACLRequest()
.withDomain("vd1.bdstatic.com")
.withRefererACL(acl);
cdnClient.setDomainRefererACL(request);
}
Query Referer Access Control
public void getDomainRefererACL(){
GetDomainRefererACLResponse response=cdnClient.getDomainRefererACL(DOMAIN);
System.out.println(response);
}
Set IP Access Control
public void testSetDomainIpACL() {
IpACL acl = new IpACL()
.addBlackList("1.2.3.4")
.addBlackList("5.6.7.0/24");
SetDomainIpACLRequest request = new SetDomainIpACLRequest()
.withDomain(DOMAIN)
.withIpACL(acl);
cdnClient.setDomainIpACL(request);
}
Query IP Access Control
public void getDomainIpACL(){
GetDomainIpACLResponse response = cdnClient.getDomainIpACL(DOMAIN);
System.out.println(response);
}
Set Access Authentication
public void testSetRequestAuth() {
RequestAuth requestAuth = new RequestAuth()
.withType("a")
.withKey1("secretkey1");
cdnClient.setRequestAuth(DOMAIN,requestAuth);
}
Set Domain Name Rate Limit
public void setTrafficLimit() {
TrafficLimit trafficLimit=new TrafficLimit();
trafficLimit.withEnable(true).withLimitRate(10485760).withLimitStartHour(10).withLimitEndHour(19)
.withLimitRateAfter(0).withTrafficLimitArg("rate").withTrafficLimitUnit("m");
SetTrafficLimitResponse response = cdnClient.setTrafficLimit(DOMAIN, trafficLimit);
System.out.println(response);
}
Set Cors Cross-domain
public void setCorsConfig(){
String domain="vd3.bdstatic.com";
CorsConfig cors=new CorsConfig()
.withAllow("on")
.addOrigin("http://www.baidu.com")
.addOrigin("http://*.bce.com");
SetCorsConfigResponse response = cdnClient.setCorsConfig(domain, cors);
System.out.println(response);
}
Query Cors Cross-domain
public void getCorsConfig(){
String domain="vd3.bdstatic.com";
GetCorsConfigResponse response = cdnClient.getCorsConfig(domain);
System.out.println(response);
}
Set IP Access Limit
public void setAccessLimit(){
String domain="vd3.bdstatic.com";
AccessLimit accessLimit=new AccessLimit().withEnabled(true).withLimit(200);
SetAccessLimitResponse response = cdnClient.setAccessLimit(domain, accessLimit);
System.out.println(response);
}
Query IP Access Frequency Limit
public void getAccessLimit(){
String domain="vd3.bdstatic.com";
GetAccessLimitResponse response = cdnClient.getAccessLimit(domain);
System.out.println(response);
}
Set to Get Real User IP
public void setObtainClientIp(){
String domain="vd3.bdstatic.com";
ClientIp clientIp = new ClientIp(true,"X-Real-IP");
SetObtainClientIpResponse response = cdnClient.setObtainClientIp(domain, clientIp);
System.out.println(response);
}
Query to Get Real User IP
public void getObtainClientIp(){
String domain="vd3.bdstatic.com";
GetObtainClientIpResponse response = cdnClient.getObtainClientIp(domain);
System.out.println(response);
}
Query Domain Name Speed Limit
public void getTrafficLimit() {
String domain="imagete11.changxin.com";
GetTrafficLimitResponse resp = cdnClient.getTrafficLimit(domain);
System.out.println(resp);
}
Set up ua Access Control
public void setUaAcl(){
String domain="vd3.bdstatic.com";
List<String> whiteList=new ArrayList<String>();
whiteList.add("MQQBrowser/5.3/Mozilla/5.0");
whiteList.add("Mozilla/5.0 (Linux; Android 7.0");
UaAcl uaAcl=new UaAcl().withWhiteList(whiteList);
SetUaAclResponse response = cdnClient.setUaAcl(domain, uaAcl);
System.out.println(response);
}
Query Access ua Control
public void getUaAcl(){
String domain="vd3.bdstatic.com";
GetUaAclResponse response = cdnClient.getUaAcl(domain);
System.out.println(response);
}