Updated on 2024-02-22 GMT+08:00

Querying Customer Resource Usage

Function

This API is used to query 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 resource usage of the customer. For details, see File Subscription.

  • 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, the partner needs to configure a schedule task in the partner sales platform to obtain the customer resource usage file at 24:00 every day.
  • The partner who subscribes to the customer resource usage in Partner Center can obtain the resource usage details file as of the following day (GMT+08:00).
  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 a 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

    File name.

    The file name format is customerUsageV2_YYYYMM_YYYYMMDD.tar.gz.

    • 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 customerUsageV2_201902_20190301.tar.gz, the data generated from February 1, 2019 to February 28, 2019 is exported on March 1, 2019.

    Files in the package are in the format of customerUsageV2_YYYYMM_YYYYMMDD_XXXXXXXX.csv. Each .csv file contains 100,000 records.

  1. Generation time of the resource usage details

    Resource usage data is summarized by month. The monthly usage details contain incremental data starting from the first day of each month. The usage details may change after being generated. Therefore, obtain 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
    File: customerUsageV2_YYYYMM_YYYYMMDD_XXXXXXXX.csv

    Parameter

    Type

    Maximum Length of Characters

    Description

    Billing Cycle

    String

    256

    Billing cycle of the consumption record

    Customer ID

    String

    256

    Domain ID of a customer

    Transaction Time

    String

    256

    Transaction time in the format of UTC

    Billing Mode

    String

    8

    Billing mode. The options are as follows:

    • 1: Yearly/monthly
    • 3: Pay-per-use
    • 10: Reserved instances
    • 11: Savings plan

    Bill Type

    String

    8

    Bill type:

    • 1: Expenditure - purchase
    • 2: Expenditure - renewal
    • 3: Expenditure - change
    • 4: Refund - unsubscription
    • 5: Expenditure - use
    • 8: Expenditure - auto-renewal
    • 9: Adjustment - compensation
    • 12: Expenditure - hourly billing
    • 13: Expenditure - unsubscription handling fee
    • 14: Expenditure - month-end deduction for support plan
    • 15: Expenditure - tax
    • 16: Adjustment - deduction
    • 17: Expenditure - difference amount (min. guaranteed-actual)
      NOTE:

      Expenditure-difference amount (min. guaranteed-actual) determines the fees that a customer needs to pay if the customer does not reach the minimum expenditure limit stipulated in the signed contract. This rule is applicable to direct sales customers and referral customers who use postpaid method.

    • 20: Refund - change
    • 23: Expenditure-savings plans
    • 24: Refund-changing to Pay-Per-Use
    • 100: Refund - unsubscription tax
    • 101: Adjustment - tax compensation
    • 102: Adjustment - tax deduction

    Resource ID

    String

    256

    Resource instance ID If the resource is a reserved instance, the value is the reserved instance ID.

    Resource Name

    String

    256

    Resource 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.

    Resource Tag

    String

    11,000

    Resource tag. Customers can set tags when managing resources.

    If a customer purchases a resource package product that is not specific to a certain resource, this field is left 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.

    Service 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

    Specifications

    String

    256

    Product specifications.

    Example: General Computing|s2.small.1|1vCPUs|1GB|linux

    Region Code

    String

    64

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

    Project ID

    String

    256

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

    Order ID/Transaction ID

    String

    256

    Order ID generated when a customer places the order. This parameter is available only for yearly/monthly products. In other cases, this parameter is left empty.

    Order Type

    String

    256

    Order type. This parameter is available only for yearly/monthly products. This parameter is left empty in the following cases:

    • 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

    Period Number

    String

    256

    Duration of a yearly/monthly subscription.

    NOTE:
    • This parameter is available only for yearly/monthly products. In other cases, this parameter is left empty.
    • The value can be an integer, or a decimal.

    Period Type

    String

    256

    Period type for yearly/monthly products. This parameter is available only for yearly/monthly products. In other cases, this parameter is left empty.

    • 0: Daily
    • 2: Monthly
    • 3: Yearly
    • 4: Hourly
    • 99: Unknown

    Usage Type

    String

    256

    Usage type, which can be obtained by calling the API described in Querying Usage Types.

    Usage

    String

    256

    Total resource usage

    Usage Unit

    String

    256

    Usage unit

    To obtain the unit, call the API in Querying Measurement Units.

    Package Usage

    String

    256

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

    Unit (Package Usage)

    String

    256

    Unit of the usage in the package

    To obtain the unit, call the API in Querying Measurement Units.

    Reserved Instance Usage

    String

    256

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

    Unit (Reserved Instance Usage)

    String

    256

    Usage unit for reserved instance

    To obtain the unit, call the API in Querying Measurement Units.

    Expenditure Amount

    String

    256

    Transaction price listed on the HUAWEI CLOUD official website, excluding the commercial discount provided by HUAWEI CLOUD for partners

    Unit: USD

    NOTE:

    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.

    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

    String

    256

    Unit of the product.

    • The unit of linear products is USD/{linear unit}/month or USD/{linear unit}/hour.
    • The unit of non-linear products is USD/month or USD/hour.
    NOTE:

    The linear unit is the unit of linear products (those come in sizes). For example, the linear unit of the hard disk is GB, and that of the bandwidth is Mbit/s.

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

    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

  1. File example

    Billing Cycle, Customer ID, Transaction Time, Billing Mode, Bill Type, Resource ID, Resource Name, Resource Tag, Service Type Code, Resource Type Code, Product ID, Product Name, Specifications, Region Code, Project ID, Order ID/Transaction ID, Order Type, Period Number, Period Type, Usage Type, Usage, Usage Unit, Package Usage, Unit (Package Usage), Reserved Instance Usage, Unit (Reserved Instance Usage), Expenditure Amount, Unit Price, Unit, Combined Order No, Product Type Name, Resource Type Name

    Apr-21, 4FB84D6C27DB4C768B0940560C2AB2CE, 2021-04-26 16:13:35 GMT+08:00, 1, 1, 34ae3e78-d93e-4d46-9bc7-aa8532e44d18, FALSE, 111, hws.service.type.ebs,hws.resource.type.volume, 5797403154426640, GD3 linear EVS disk_ Monthly, GD3 linear EVS disk_ Monthly 1, cn-north-1, ab7eb17368654ff4b1bb3c63c6a478e0,CS20012416121ADNL2, 1, 1, 99, Duration-1, 12312.125, 1, 123, 3, 120, 1, 8400, 12312.123, 1, CS20012416121ADNL3, Elastic Cloud Server, Cloud Host