阅读本文,您可以获取 Java SDK 用量统计的接口调用示例,实现快速开发。
调用接口前,请先完成 Java SDK 的安装及初始化操作。
本节为您介绍用量统计相关接口的功能和调用示例。
您可以调用 DescribeImageXSummary 接口获取用户的本月资源用量概览。详细的参数说明可参见 DescribeImageXSummary 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXSummaryExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXSummaryQuery query = new DescribeImageXSummaryQuery(); try { DescribeImageXSummaryRes resp = service.describeImageXSummary(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXDomainTrafficData 接口获取指定时间段内加速域名网络流量用量。详细的参数说明可参见 DescribeImageXDomainTrafficData 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXDomainTrafficDataExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXDomainTrafficDataQuery query = new DescribeImageXDomainTrafficDataQuery(); try { DescribeImageXDomainTrafficDataRes resp = service.describeImageXDomainTrafficData(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXDomainBandwidthData 接口获取指定时间段内加速域名网络带宽用量。详细的参数说明可参见 DescribeImageXDomainBandwidthData 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXDomainBandwidthDataExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXDomainBandwidthDataQuery query = new DescribeImageXDomainBandwidthDataQuery(); try { DescribeImageXDomainBandwidthDataRes resp = service.describeImageXDomainBandwidthData(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXRequestCntUsage 接口获取指定时间段的请求次数。详细的参数说明可参见 DescribeImageXRequestCntUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXRequestCntUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXRequestCntUsageQuery query = new DescribeImageXRequestCntUsageQuery(); try { DescribeImageXRequestCntUsageRes resp = service.describeImageXRequestCntUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXBaseOpUsage 接口获取指定时间维度的图像基础处理量。详细的参数说明可参见 DescribeImageXBaseOpUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXBaseOpUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXBaseOpUsageQuery query = new DescribeImageXBaseOpUsageQuery(); try { DescribeImageXBaseOpUsageRes resp = service.describeImageXBaseOpUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXBucketUsage 接口获取指定时间段的资源占用量。详细的参数说明可参见 DescribeImageXBucketUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXBucketUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXBucketUsageQuery query = new DescribeImageXBucketUsageQuery(); try { DescribeImageXBucketUsageRes resp = service.describeImageXBucketUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXCompressUsage 接口获取指定时间段内的图像高效压缩量。详细的参数说明可参见 DescribeImageXCompressUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXCompressUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXCompressUsageQuery query = new DescribeImageXCompressUsageQuery(); try { DescribeImageXCompressUsageRes resp = service.describeImageXCompressUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXMultiCompressUsage 接口获取指定时间段内的多文件压缩用量。详细的参数说明可参见 DescribeImageXMultiCompressUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXMultiCompressUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXMultiCompressUsageQuery query = new DescribeImageXMultiCompressUsageQuery(); try { DescribeImageXMultiCompressUsageRes resp = service.describeImageXMultiCompressUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }
您可以调用 DescribeImageXBillingRequestCntUsage 接口获取指定时间段内的附加组件通用请求次数
。详细的参数说明可参见 DescribeImageXBillingRequestCntUsage 接口文档。
接口调用示例如下所示。
package com.volcengine.example.imagex.v2.api; import com.volcengine.model.imagex.v2.*; import com.volcengine.service.imagex.v2.ImagexService; public class DescribeImageXBillingRequestCntUsageExample { public static void main(String[] args) { ImagexService service = ImagexService.getInstance(); service.setAccessKey("ak"); service.setSecretKey("sk"); DescribeImageXBillingRequestCntUsageQuery query = new DescribeImageXBillingRequestCntUsageQuery(); try { DescribeImageXBillingRequestCntUsageRes resp = service.describeImageXBillingRequestCntUsage(query); System.out.println(resp); } catch (Exception e) { e.printStackTrace(); } } }