Baidu AI Cloud
中国站

百度智能云

CDN

CdnClient

Being the client of the CDN service, CdnClient provides a series of methods for developers to interact with the CDN service.

Create CdnClient

Access to CDN via AK/SK

Access CDN via AK/SK, and users can create a CDN Client by reference to the following codes:

public class Sample { 
public static void main(String[] args) { 
    String endPoint = "http://cdn.baidubce.com";                     //CDN server interface address 
    String accessKeyId =1f46192b-1365-11e7-9b89-6c40088dcee6”;     //User's Access Key ID 
    String secretAccessKy =258ddd5c-1365-11e7-a459-6c40088dcee6”;  //User's Secret Access Key 
    BceClientConfiguration config = new BceClientConfiguration() 
                .withCredentials(new DefaultBceCredentials(accessKeyId, secretAccessKy)) 
                .withEndpoint(endPoint); 
    CdnClient cdnClient = new CdnClient(config); 
} 

In the above code, the variables accessKeyId and secretAccessKy are assigned to user by the system, and they are strings used to identify the user and perform signature verification for accessing CDN. accessKeyId corresponds to “Access Key ID” in the console and secretAccessKy corresponds to “Access Key Secret”; see “Manage ACCESSKEY” for more methods.

Previous
Getting Started
Next
Acceleration Domain Name Management