Updated on 2024-09-26 GMT+08:00

Querying Customer Resource Usage

Function

This API is used to query customer resource usage.

This API will be taken offline. For details about the new API for querying customer resource usage, see Querying Customer Resource Usage.

The resource usage data has a latency. Therefore, the data cannot be used when there are high requirements on data accuracy, such as for usage monitoring or budget control.

File

A partner can subscribe to the customer resource usage in HUAWEI CLOUD Partner Center to learn the partner's resource utilization.

The system generates the customer resource usage file containing the data generated till the previous day from 12:00 to 20:00 (GMT+8:00) (not later than 24:00) every day. Therefore, it is recommended that the partner sales platform obtains the customer resource usage file at 24:00 every day.

  1. Link to obtain the file

    https://bucketname.obs.Endpoint.myhuaweicloud.com/customerUsage/filename

    Table 1 Parameter description

    Parameter

    Description

    bucketname

    Name of an OBS bucket. Only OBS buckets purchased on HUAWEI CLOUD in the Hong Kong region can be used. For details about how to create an OBS bucket, see Creating a Bucket.

    NOTE:

    You cannot use your account to buy OBS buckets. Instead, you can use your customers' accounts to do so.

    Endpoint

    Domain name or IP address of the server bearing the REST service endpoint. Obtain this value from Regions and Endpoints.

    customerUsage

    Name of the folder for storing the customer resource usage details uploaded by the system.

    filename

    Specifies the file name.

    The file is named in the customerUsage_YYYYMM_YYYYMMDD.tar.gz format.

    The file is a compressed package.

    YYYYMM indicates the month of the data to be exported. For example, if the data for February 2019 is exported, YYYYMM should be 201902.

    YYYYMMDD specifies the date when the customer resource usage data is exported. For example, if the file name is customerUsage_201902_20190301.tar.gz, the data generated from February 1, 2019 to February 28, 2019 is exported on March 1, 2019.

    The files in the compressed package are named in the format of customerUsage_MonthlyYearly_YYYYMM_YYYYMMDD_XXXXXXXX.csv, customerUsage_PerByUse_YYYYMM_YYYYMMDD_XXXXXXXX.csv, or customerUsage_RI_YYYYMM_YYYYMMDD_XXXXXXXX.csv.

  1. Generation time of the resource usage details

    The resource usage data is summarized by month. The monthly usage details contain incremental data starting from the first day of each month. The data of usage detail may change after being generated. Use the latest data.

    The system generates the resource usage details from 12:00 to 20:00 (GMT+8:00) (not later than 24:00) every day.

    • The usage details of each month are generated on the first day of the following month. For example, the usage details of July are generated on August 1.
    • The month-to-date usage details of the current month and all usages details of the last month are generated on the second to fourth day of the current month. For example, the usage details of August 1 and August 2 and of July are generated on August 3.
    • The usage details of this month are generated on the fifth day to the end of this month. For example, the usage details from August 1 to August 5 are generated on August 6.

  1. File fields
    • Yearly/monthly resources (usage of reseller customers only)

      customerUsage_MonthlyYearly_YYYYMM_YYYYMMDD_XXXXXXXX.csv

      Parameter

      Type

      Value Limit

      Description

      Customer

      String

      256

      Domain ID of a customer.

      Expenditure or Unsubscription Time

      String

      256

      UTC.

      Resource ID

      String

      256

      Resource instance ID.

      Resource Name

      String

      256

      Name entered when a customer creates a resource instance.

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Product Type Code

      String

      64

      Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

      Resource Type Code

      String

      100

      Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types.

      Product ID

      String

      256

      Product ID.

      Product Name

      String

      256

      Product name.

      Product Specifications

      String

      256

      Product specifications, such as

      General Computing|s2.small.1|1 vCPU|1 GB|Linux

      Region

      String

      64

      Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

      Order No.

      String

      256

      Order ID generated when a customer places the order.

      Order Type

      String

      256

      Order Type:

      • 1: New purchase
      • 2: Renewal
      • 3: Change
      • 4: Unsubscription
      • 10: Yearly/monthly to pay-per-use
      • 11: Pay-per-use to yearly/monthly
      • 13: Trial
      • 14: Commercial use
      • 15: Price adjustment

      Duration

      String

      256

      Duration of a yearly/monthly subscription.

      Period Type

      String

      256

      Duration type of a yearly/monthly subscription.

      0: Daily

      1: Weekly

      2: Monthly

      3: Yearly

      4: Hourly

      5: One-off

      Amount(USD)

      String

      256

      Transaction price listed on the HUAWEI CLOUD official website, excluding the commercial discount provided by HUAWEI CLOUD for partners. The unit is US Dollar.

      Project ID

      String

      256

      ID of the project to which a resource belongs. You can select a project when purchasing a resource.

      Resource Tag

      String

      11,000

      Resource tag. Customers can set tags when managing resources. If a yearly/monthly subscription is not intended for a specific resource, leave this field empty.

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Combined Order No

      String

      256

      The combined order number generated when a customer places orders. This parameter is available only for yearly/monthly products. In other cases, this parameter is left empty.

      This parameter is reserved.

      Product Type Name

      String

      200

      Product type name

      Resource Type Name

      String

      200

      Resource type name.

    • Pay-per-use resources (usage of reseller customers only)

      customerUsage_PerByUse_YYYYMM_YYYYMMDD_XXXXXXXX.csv

      Parameter

      Type

      Value Range

      Description

      Customer

      String

      256

      Domain ID of a customer.

      Expenditure Time

      String

      256

      Transaction time in the format of UTC.

      Billing Cycle

      String

      256

      Billing cycle of the consumption record.

      Resource ID

      String

      256

      Resource instance ID.

      Resource Name

      String

      256

      Name entered when a customer creates a resource instance.

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Product Type Code

      String

      64

      Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

      Resource Type Code

      String

      100

      Resource type code. For example, the VM resource type code of ECS is hws.resource.type.vm. To obtain a specific resource type, call the API in Querying Resource Types.

      Product ID

      String

      256

      Product ID.

      Product Name

      String

      256

      Product Name.

      Product Specifications

      String

      256

      Product specifications, such as

      General Computing|s2.small.1|1 vCPU|1 GB|Linux

      Region

      String

      64

      Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

      Billing Item

      String

      256

      Usage factor. (Usage type)

      The value is the same as the usage factor in SDRs. The mappings between cloud services and usage factors are as follows:

      • ECS: Duration
      • EVS: Duration
      • EIP: Duration
      • Bandwidth: Duration (by bandwidth) or upflow (by traffic)
      • Marketplace image: Duration

      Usage

      String

      256

      Total resource usage.

      Package Usage

      String

      256

      Used amount of the package. The used resources are not calculated using the pay-per-use price.

      Reserved Instance Usage

      String

      A maximum of 256 characters

      Used reserved instance. The used resources are not calculated using the pay-per-use price.

      Unit

      String

      256

      Usage unit. The optional values are as follows:

      • 0: DAY (duration)
      • 1: YUAN (currency)
      • 2: JIAO (currency)
      • 3: FEN (currency)
      • 4: Hour (duration)
      • 5: MINUTE (duration)
      • 6: SECOND (duration)
      • 7: EB (traffic)
      • 8: PB (traffic)
      • 9: TB (traffic)
      • 10: GB (traffic)
      • 11: MB (traffic)
      • 12: KB (traffic)
      • 13: Byte (traffic)
      • 14: amount (quantity)
      • 15: Mbps (traffic)
      • 16: Byte (capacity)
      • 17: GB (traffic)
      • 18: KLOC (number of lines)
      • 19: YEAR (period)
      • 20: MONTH (period)
      • 21: MB (traffic)
      • 22: GHz (frequency)
      • 23: CORE (quantity)
      • 24: DAY (period)
      • 25: HOUR (period)
      • 30: number (quantity)
      • 31: Thousand times (quantity)
      • 32: Million times (quantity)
      • 33: Billion times (quantity)
      • 34: bps (bandwidth)
      • 35: kbps (bandwidth)
      • 36: Mbps (bandwidth)
      • 37: Gbps (bandwidth)
      • 38: Tbps (bandwidth)
      • 39: GB-seconds (capacity-duration)
      • 40: times (quantity)
      • 41: PCS (quantity)
      • 42: Thousand PCS (quantity)
      • 43: PCS (quantity)
      • 44: Thousand PCS (quantity)
      • 45: Query Per Second (query rate)
      • 46: Man/Day (quantity)
      • 47: TB (capacity)
      • 48: PB (capacity)

      Amount(USD)

      String

      A maximum of 256 characters

      Transaction price listed on the HUAWEI CLOUD official website, excluding the commercial discount provided by HUAWEI CLOUD for partners. The unit is US Dollar.

      If HUAWEI CLOUD writes off the outstanding amount as required or refunds the over-deducted amount, a record with the negative amount will be generated.

      Project ID

      String

      256

      ID of the project to which a resource belongs. You can select a project when purchasing a resource.

      Resource Tag

      String

      11,000

      Resource tag. Customers can set tags when managing resources.

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Unit Price

      String

      256

      Unit price of a pay-per-use product. This parameter has a value only when the price is the same. For tiered billing, this parameter is left empty.

      Unit(Unit Price)

      String

      256

      Unit(Unit Price)

      For example, the price is $0.6 USD/10,000 times. The unit price is 0.6, the price unit is US Dollar, and the step is 10,000 times. The unit price is 0.6 and the price unit is US Dollar/10,000 times.

      Product Type Name

      String

      200

      Product type name

      Resource Type Name

      String

      200

      Resource type name.

    • Reserved instances (usage of reseller customers only)

      customerUsage_RI_YYYYMM_YYYYMMDD_XXXXXXXX.csv

      Parameter

      Type

      Value Range

      Description

      Customer

      String

      A maximum of 256 characters

      Domain ID of a customer.

      Expenditure or Unsubscription Time

      String

      256

      UTC.

      Expenditure Type

      String

      256

      1: Subscription

      2: Renewal

      3: Change

      4: Unsubscription

      8: Automatic renewal

      12: Recurring fee for reserved instances

      Reserved Instance ID

      String

      256

      ID of a purchased reserved instance.

      Reserved Instance Name

      String

      256

      Name of a reserved instance.

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Product Type Code

      String

      64

      Cloud service type code. For example, the cloud service type code of OBS is hws.service.type.obs. To obtain a specific service type, call the API in Querying Cloud Service Types.

      Region

      String

      64

      Cloud service region code, for example, ap-southeast-1. Obtain the value from the Region column in Regions and Endpoints.

      Product

      String

      256

      Product ID.

      Order No.

      String

      256

      Order ID of a reserved instance order.

      Amount(USD)

      String

      256

      Transaction price listed on the HUAWEI CLOUD official website, excluding the commercial discount provided by HUAWEI CLOUD for partners. The unit is US Dollar.

      Project ID

      String

      A maximum of 256 characters

      ID of the project to which a resource belongs. You can select a project when purchasing a resource.

      Resource Tag

      String

      11,000

      Resource tag. Customers can set tags when managing resources.

      Currently, the reserved instance does not belong to a specific resource. This field is left blank (reserved).

      NOTE:

      If the entered character strings are risky, such as {"=", "+", "-", "@"}, followed by non-pure numbers, then double quotation marks will be added for that field, one at the beginning of the field and the other at the end.

      Product Type Name

      String

      200

      Product type name

  1. File example
    1. File of yearly/monthly resources
      • Field:

        customerUsage_MonthlyYearly_201905_20190521_232738ebd8d044ac8006571d694ff05d.csv

      • Content:

        Customer,Expenditure or Unsubscription Time,Resource ID,Resource Name,Product Type Code,Resource Type Code,Product ID,Product Name,Product Specifications,Region,Order No.,Order Type,Duration,Period Type,Amount(USD),Project ID,Resource Tag,Product Type Name,Resource Type Name

        37be0256053e467ba425d6dd61135370,2019-05-06 14:30:25 GMT+00:00,57f5faa7-0aa5-4f13-91e7-b838a6b69178,volume-220f,hws.service.type.ebs,hws.resource.type.volume,00301-03439-0--0,GD3 linear EVS_Monthly,Common IO|10.0|17,cn-north-7,CS1905061430U2BKA,4,,2,0.00,6a4cffd705254584a4386d30b3e15df9,resourcetag008,lastic Cloud Server,Cloud Host

    2. File of pay-per-use resources
      • Field:

        customerUsage_PerByUse_201905_20190521_c40692bef76442e688e044530d62eb03.csv

      • Content:

        Customer,Expenditure Time,Billing Cycle,Resource ID,Resource Name,Product Type Code,Resource Type Code,Product ID,Product Name,Product Specifications,Region,Billing Item,Usage,Package Usage,Reserved Instance Usage,Unit,Amount(USD),Project ID,Resource Tag,Unit,Unit Price,Product Type Name,Resource Type Name

        b9965f7fa88a49d3aa571d6ab25543fb,2019-05-01 10:00:00 GMT+00:00 - 2019-05-01 23:59:59 GMT+00:00,20190501,bf930731-996d-422e-a2ec-f556d88bc784,ecs-a5d9-volume-0001,hws.service.type.ebs,hws.resource.type.volume,00301-18779-0--0,GD3 linear EVS_On demand,Common IO|duration,cn-north-7,duration,"22,545.00",,0.00,6,0.02,6a4cffd705254584a4386d30b3e15df9,resourcetag001,0,1,lastic Cloud Server,Cloud Host

    3. File of reserved instances
      • Field:

        customerUsage_RI_201905_20190521_f5ee75c834494106b39f4511d20cb416.csv

      • Content:

        Customer,Expenditure or Unsubscription Time,Expenditure Type,Reserved Instance ID,Reserved Instance Name,Product Type Code,Region,Product,Order No.,Amount(USD),Project ID,Resource Tag,Product Type Name

        37be0256053e467ba425d6dd61135370,2019-05-07 15:01:17 GMT+00:00,Subscribed Order,01154-3100049-0,,hws.service.type.ec2,cn-north-7,General Computing Enhaced_C3_2U4G_linux reserve,CS19050715008ZEL8,516.84,6a4cffd705254584a4386d30b3e15df9,resourcetag002,lastic Cloud Server