You need to enable JavaScript to run this app.
视频点播

视频点播

复制全文
Java SDK
分发加速
复制全文
分发加速

本文提供服务端 Java SDK 分发加速相关接口的调用示例。

前提条件

调用接口前,请确保您已完成集成 Java SDK

调用示例

添加域名

接口请求参数和返回参数说明详见 CreateDomain - 添加域名

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodCreateDomainDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodCreateDomainV2Request.Builder reqBuilder = com.volcengine.service.vod.model.request.VodCreateDomainV2Request.newBuilder();
            reqBuilder.setSpaceName("your SpaceName");
            reqBuilder.setDomainType("your DomainType");
            reqBuilder.setDomain("your Domain");
            reqBuilder.setSourceStationType(0);
            reqBuilder.setSourceStationAddressType(0);
            reqBuilder.setOrigins("your Origins");
            reqBuilder.setArea("your Area");

            com.volcengine.service.vod.model.response.VodCreateDomainV2Response resp = vodService.createDomain(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

启用域名

接口请求参数和返回参数说明详见 StartDomain - 启用域名

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodStartDomainDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodStartDomainRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodStartDomainRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         reqBuilder.setSourceStationType(0);
         
            com.volcengine.service.vod.model.response.VodStartDomainResponse resp = vodService.startDomain(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

停用域名

接口请求参数和返回参数说明详见 StopDomain - 停用域名

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodStopDomainDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodStopDomainRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodStopDomainRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         reqBuilder.setSourceStationType(0);
         
            com.volcengine.service.vod.model.response.VodStopDomainResponse resp = vodService.stopDomain(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

删除域名

接口请求参数和返回参数说明详见 DeleteDomain - 删除域名

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodDeleteDomainDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");
        try {
            com.volcengine.service.vod.model.request.VodDeleteDomainRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodDeleteDomainRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         
            com.volcengine.service.vod.model.response.VodDeleteDomainResponse resp = vodService.deleteDomain(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取空间域名列表

接口请求参数和返回参数说明详见 ListDomain - 获取空间域名列表

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodListDomainDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();
        
        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodListDomainRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodListDomainRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setSourceStationType(0);
         reqBuilder.setOffset(0);
         reqBuilder.setLimit(0);
         
            com.volcengine.service.vod.model.response.VodListDomainResponse resp = vodService.listDomain(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

将域名添加至点播调度

接口请求参数和返回参数说明详见 AddDomainToScheduler - 将域名添加至点播调度

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodAddDomainToSchedulerDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodAddDomainToSchedulerRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodAddDomainToSchedulerRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         reqBuilder.setSourceStationType(0);
         
            com.volcengine.service.vod.model.response.VodAddDomainToSchedulerResponse resp = vodService.addDomainToScheduler(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

将域名从点播调度移除

接口请求参数和返回参数说明详见 RemoveDomainFromScheduler - 将域名从点播调度移除

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodRemoveDomainFromSchedulerDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodRemoveDomainFromSchedulerRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodRemoveDomainFromSchedulerRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         reqBuilder.setSourceStationType(0);
         
            com.volcengine.service.vod.model.response.VodRemoveDomainFromSchedulerResponse resp = vodService.removeDomainFromScheduler(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

设置多域名调度策略

接口请求参数和返回参数说明详见 UpdateDomainPlayRule - 设置多域名调度策略

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodUpdateDomainPlayRuleDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodUpdateDomainPlayRuleRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateDomainPlayRuleRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDefaultDomain("your DefaultDomain");
         reqBuilder.setPlayRule("your PlayRule");
         
            com.volcengine.service.vod.model.response.VodUpdateDomainPlayRuleResponse resp = vodService.updateDomainPlayRule(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新域名时间戳防盗链配置

接口请求参数和返回参数说明详见 UpdateDomainExpire - 更新域名时间戳防盗链配置

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodUpdateDomainExpireDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodUpdateDomainExpireV2Request.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateDomainExpireV2Request.newBuilder();
            reqBuilder.setSpaceName("your SpaceName");
            reqBuilder.setDomainType("your DomainType");
            reqBuilder.setDomain("your Domain");
            reqBuilder.setExpire(0);

            com.volcengine.service.vod.model.response.VodUpdateDomainExpireV2Response resp = vodService.updateDomainExpire(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

更新域名 URL 鉴权配置

接口请求参数和返回参数说明详见 UpdateDomainAuthConfig - 更新域名 URL 鉴权配置

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodUpdateDomainUrlAuthConfigDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodUpdateDomainUrlAuthConfigV2Request.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateDomainUrlAuthConfigV2Request.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setDomainType("your DomainType");
         reqBuilder.setDomain("your Domain");
         reqBuilder.setMainKey("your MainKey");
         reqBuilder.setBackupKey("your BackupKey");
         reqBuilder.setStatus("your Status");
         
            com.volcengine.service.vod.model.response.VodUpdateDomainUrlAuthConfigV2Response resp = vodService.updateDomainUrlAuthConfig(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

创建缓存刷新任务

接口请求参数和返回参数说明详见 CreateCdnRefreshTask - 创建缓存刷新任务

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodCreateCdnRefreshTaskDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodCreateCdnRefreshTaskRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodCreateCdnRefreshTaskRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setUrls("your Urls");
         reqBuilder.setType("your Type");
         
            com.volcengine.service.vod.model.response.VodCreateCdnRefreshTaskResponse resp = vodService.createCdnRefreshTask(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

创建内容预热任务

接口请求参数和返回参数说明详见 CreateCdnPreloadTask - 创建内容预热任务

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodCreateCdnPreloadTaskDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodCreateCdnPreloadTaskRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodCreateCdnPreloadTaskRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setUrls("your Urls");
         
            com.volcengine.service.vod.model.response.VodCreateCdnPreloadTaskResponse resp = vodService.createCdnPreloadTask(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取刷新预热任务列表

接口请求参数和返回参数说明详见 ListCdnTasks - 获取刷新预热任务列表

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodListCdnTasksDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodListCdnTasksRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodListCdnTasksRequest.newBuilder();
         reqBuilder.setSpaceName("your SpaceName");
         reqBuilder.setTaskId("your TaskId");
         reqBuilder.setDomainName("your DomainName");
         reqBuilder.setTaskType("your TaskType");
         reqBuilder.setStatus("your Status");
         reqBuilder.setStartTimestamp(0);
         reqBuilder.setEndTimestamp(0);
         reqBuilder.setPageNum(0);
         reqBuilder.setPageSize(0);
         
            com.volcengine.service.vod.model.response.VodListCdnTasksResponse resp = vodService.listCdnTasks(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

获取日志文件下载地址

接口请求参数和返回参数说明详见 ListCdnAccessLog - 获取日志文件下载地址

package com.volcengine.example.vod.cdn;

import com.volcengine.service.vod.IVodService;
import com.volcengine.service.vod.impl.VodServiceImpl;
public class VodListCdnAccessLogDemo {

    public static void main(String[] args) throws Exception {
        // Create a VOD instance in the specified region.
        // IVodService vodService = VodServiceImpl.getInstance("cn-north-1");
        IVodService vodService = VodServiceImpl.getInstance();

        // Configure your Access Key ID (AK) and Secret Access Key (SK) in the environment variables or in the local ~/.volc/config file. For detailed instructions, see https://www.volcengine.com/docs/4/65641.
        // The SDK will automatically fetch the AK and SK from the environment variables or the ~/.volc/config file as needed.
        // During testing, you may use the following code snippet. However, do not store the AK and SK directly in your project code to prevent potential leakage and safeguard the security of all resources associated with your account.
        // vodService.setAccessKey("your ak");
        // vodService.setSecretKey("your sk");

        try {
            com.volcengine.service.vod.model.request.VodListCdnAccessLogRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodListCdnAccessLogRequest.newBuilder();
         reqBuilder.setDomains("your Domains");
         reqBuilder.setStartTimestamp(0);
         reqBuilder.setEndTimestamp(0);
         reqBuilder.setSpaceName("your SpaceName");
         
            com.volcengine.service.vod.model.response.VodListCdnAccessLogResponse resp = vodService.listCdnAccessLog(reqBuilder.build());
            if (resp.getResponseMetadata().hasError()) {
                System.out.println(resp.getResponseMetadata().getError());
                System.exit(-1);
            }
            System.out.println(resp);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
最近更新时间:2025.12.18 19:02:47
这个页面对您有帮助吗?
有用
有用
无用
无用