本文为您提供服务端 Java SDK 空间管理模块的接口调用示例。
接口请求参数和返回参数说明详见 CreateSpace。
package com.volcengine.example.vod.space; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodCreateSpaceDemo { 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.VodCreateSpaceRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodCreateSpaceRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); reqBuilder.setProjectName("your ProjectName"); reqBuilder.setDescription("your Description"); reqBuilder.setRegion("your Region"); reqBuilder.setUserName("your UserName"); com.volcengine.service.vod.model.response.VodCreateSpaceResponse resp = vodService.createSpace(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见 ListSpace。
package com.volcengine.example.vod.space; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodListSpaceDemo { 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.VodListSpaceRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodListSpaceRequest.newBuilder(); reqBuilder.setOffset(0); reqBuilder.setLimit(0); com.volcengine.service.vod.model.response.VodListSpaceResponse resp = vodService.listSpace(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见 GetSpaceDetail。
package com.volcengine.example.vod.space; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodGetSpaceDetailDemo { 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.VodGetSpaceDetailRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodGetSpaceDetailRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); com.volcengine.service.vod.model.response.VodGetSpaceDetailResponse resp = vodService.getSpaceDetail(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见 UpdateSpace。
package com.volcengine.example.vod.space; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodUpdateSpaceDemo { 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.VodUpdateSpaceRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateSpaceRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); reqBuilder.setSourceProjectName("your SourceProjectName"); reqBuilder.setTargetProjectName("your TargetProjectName"); reqBuilder.setDescription("your Description"); com.volcengine.service.vod.model.response.VodUpdateSpaceResponse resp = vodService.updateSpace(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
接口请求参数和返回参数说明详见 UpdateSpaceUploadConfig。
package com.volcengine.example.vod.space; import com.volcengine.service.vod.IVodService; import com.volcengine.service.vod.impl.VodServiceImpl; public class VodUpdateSpaceUploadConfigDemo { 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.VodUpdateSpaceUploadConfigRequest.Builder reqBuilder = com.volcengine.service.vod.model.request.VodUpdateSpaceUploadConfigRequest.newBuilder(); reqBuilder.setSpaceName("your SpaceName"); reqBuilder.setConfigKey("your ConfigKey"); reqBuilder.setConfigValue("your ConfigValue"); com.volcengine.service.vod.model.response.VodUpdateSpaceUploadConfigResponse resp = vodService.updateSpaceUploadConfig(reqBuilder.build()); if (resp.getResponseMetadata().hasError()) { System.out.println(resp.getResponseMetadata().getError()); System.exit(-1); } System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }