xpanse icon indicating copy to clipboard operation
xpanse copied to clipboard

handle BSS APIs not available in all regions

Open swaroopar opened this issue 6 months ago • 1 comments

Currently the BSS APIs are not available in all regions. For example on eu-west-101 region, there is no API available. So if the the user is using his eu-west-101 credentials, then call to bss and bss-intl will fail since the eu-west-101 IAM is different to other regions. New proposed solution to be tried is

  • [ ] Try bss-intl -> if fails, try bss
  • [ ] if even that fails, then try the public API which is also used by the page - https://www.huaweicloud.com/intl/en-us/pricing/calculator.html#/ecs this uses the API and does not need any credentials. -> https://portal-intl.huaweicloud.com/api/cbc/global/rest/BSS/billing/ratingservice/v2/inquiry/resource
  • [ ] Remove the extra check for text "CBC". https://github.com/eclipse-xpanse/xpanse/blob/main/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/price/HuaweiCloudPriceCalculator.java#L110
  • [ ] Currently when we get errors, we ignore it and directly set only the license price and markup price as recurring price. This must be avoided - https://github.com/eclipse-xpanse/xpanse/blob/main/plugins/huaweicloud/src/main/java/org/eclipse/xpanse/plugins/huaweicloud/price/HuaweiCloudPriceCalculator.java#L110 sample request
{
    "regionId": "eu-west-101",
    "chargingMode": 1,
    "periodType": 4,
    "periodNum": 1,
    "subscriptionNum": 1,
    "productInfos": [
        {
            "id": "1722586728180-0-OFFI796331475118358528",
            "cloudServiceType": "hws.service.type.ec2",
            "resourceType": "hws.resource.type.vm",
            "resourceSpecCode": "c6.2xlarge.2.linux",
            "productNum": 1,
            "usageFactor": "Duration",
            "usageMeasureId": 4,
            "usageValue": 1
        },
        {
            "id": "1722586728180-1-OFFI794174495392378882",
            "cloudServiceType": "hws.service.type.ebs",
            "resourceType": "hws.resource.type.volume",
            "resourceSpecCode": "GPSSD",
            "productNum": 1,
            "resourceSize": 40,
            "resouceSizeMeasureId": 17,
            "usageFactor": "Duration",
            "usageMeasureId": 4,
            "usageValue": 1
        },
        {
            "id": "1722586728180-2-OFFI794477835484422145",
            "cloudServiceType": "hws.service.type.vpc",
            "resourceType": "hws.resource.type.bandwidth",
            "resourceSpecCode": "19_bgp",
            "productNum": 1,
            "resourceSize": 5,
            "resouceSizeMeasureId": 15,
            "usageFactor": "Duration",
            "usageMeasureId": 4,
            "usageValue": 1
        }
    ]
}

swaroopar avatar Aug 02 '24 09:08 swaroopar