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

Purchasing a FlexusL Instance

Function

This API is used to subscribe to one or more FlexusL instances.

This API is an asynchronous API. After a subscription API request is delivered, order_id and instances_ids are returned. In this case, the order is created, but the FlexusL instance is not created.

Use the order_id returned by this API to call the API of Querying Order Details. Check the creation status of the FlexusL instance based on the value of status in the response message. If the value of status is 5, the FlexusL instance is created.

API Gateway Address

https://hcss.ap-southeast-3.myhuaweicloud.com

URL

POST /v1/light-instances

Request Message

Table 1 Header parameters

Parameter

Mandatory

Type

Description

Client-Request-Id

Yes

String

Unique request ID. It is specified by a user and is used to locate a request. UUID is recommended.

The value contains 36 to 128 characters.

X-Auth-Token

Yes

String

User token.

This API uses token authentication. You can obtain the token by calling the API of Obtaining a User Token Through Password Authentication.

The value of X-Auth-Token is that of X-Subject-Token in the response message header of the API of Obtaining a User Token Through Password Authentication.

Table 2 Body parameters.

Parameter

Mandatory

Type

Description

instance_name

Yes

String

Instance name. The value can contain letters, digits, underscores (_), and hyphens (-). The name is case-sensitive and must start with a letter.

The value contains 1 to 128 characters.

description

No

String

Instance description.

The value contains 0 to 1024 characters.

plan_spec

Yes

String

Specification code.

Different images support different specification codes. For details, see Appendix.

image_ref

No

ImageRef

Image information. For details, see Table 3.

region

Yes

String

Region.

Currently, only ap-southeast-1 (CN-Hong Kong), ap-southeast-3 (AP-Singapore), ap-southeast-2 (AP-Bangkok), tr-west-1 (TR-Istanbul), sa-brazil-1 (LA-Sao Paulo1), and me-east-1 (ME-Riyadh) are supported.

charging_mode

No

String

Billing mode. The default value is prePaid, which indicates the yearly/monthly billing mode.

period_type

Yes

String

Subscription period.

  • month: indicates that the subscription period is month.
  • year: indicates that the subscription period is year.

period_num

Yes

String

Subscribed periods.

  • If periodType is month, the value ranges from 1 to 9.
  • If periodType is year, the value ranges from 1 to 3.

purchase_quantity

No

int

Purchase quantity. The default value is 1.

Value range: [1,200]

is_auto_renew

No

boolean

Whether auto-renewal is enabled. The default value is false.

  • true: indicates that auto-renewal is enabled.
  • false: indicates that auto-renewal is disabled.

is_auto_pay

No

boolean

Whether the payment will be automatically deducted from your account balance when an order is submitted. The default value is false.

  • true: The order will be automatically paid.
  • false: You must manually pay the order.

ExtraResources

No

Array of ExtraResources

Additional resource information. For details, see Table 4.

tags

No

Array of Tags

Custom tags. For details, see Table 5.

Table 3 Parameters in ImageRef

Parameter

Mandatory

Type

Description

image_name

No

String

Names of the application images or system images supported by a FlexusL instance.

This parameter is required when a FlexusL instance is created using application images or system images. This parameter is not required when a FlexusL instance is created using a private image.

For details about the supported image names, see Application Images or System Images.

image_version

No

String

Versions of the application images or system images supported by a FlexusL instance.

This parameter is required when a FlexusL instance is created using application images or system images. This parameter is not required when a FlexusL instance is created using a private image.

For details about the supported image versions, see Application Images or System Images.

image_id

No

String

Private image ID.

The image ID of the private image is provided by a user only when a private image is used to create a FlexusL instance. This parameter is not required if a system image or application image is used to create a FlexusL instance.

Table 4 Parameters in ExtraResources

Parameter

Mandatory

Type

Description

type

Yes

String

Additional resource type.

Currently, evs, cbr, and hss are supported.

  • evs indicates data disks.
  • cbr indicates cloud backups.
  • hss indicates host security.

size

No

Int

Capacity of the additional EVS or CBR resources. The unit is GiB. The value range is [10,2048].

This parameter is not involved for the hss resource type.

Table 5 Tags parameters

Parameter

Mandatory

Type

Operation

key

Yes

String

Key. The value contains 1 to 32 characters.

value

Yes

String

Tag value. The value contains 0 to 2,048 characters.

Response Message

Table 6 Tags parameters

Parameter

Type

Description

order_id

String

Order number.

instance_ids

Array of strings

Instance IDs.

Use the order_id returned by this API to call the API of Querying Order Details. Check the creation status of the FlexusL instance based on the value of status in the response message. If the value of status is 5, the FlexusL instance is created.

Example Request

Create an order of two instances named test-0620-01. The instances use the flavor code hf.large.1.30m.linux and image version BT 6.8.35 and are created in the AP-Singapore region. The required duration is 1 month, and auto payment and auto-renewal are enabled. The order also includes 20 GB data disks, 20 GB cloud backups, and HSS.

{
  "instance_name": "test-0620-01",
  "description": "test",
  "plan_spec": "hf.large.1.30m.linux",
  "image_ref": {
    "image_name": "BT",
    "image_version": "6.8.35"
  },
  "region": "ap-southeast-3",
  "charging_mode": "prePaid",
  "period_type": "month",
  "period_num": 1,
  "purchase_quantity": 2,
  "is_auto_renew": true,
  "is_auto_pay": true
  ,"extra_resources": [
    {
      "type": "evs",
      "size": 20
    },
    {
      "type": "cbr",
      "size": 20
    },
    {
      "type": "hss"
    }
  ]
}

Example Response

{
    "order_id": "CS24022811305H1EW",
    "instance_ids": [
        "65dea8d23005da564c78d9d2"
    ]
 }

Returned Values

Table 7 Returned values

Status Code

Description

202

The request is accepted and processed asynchronously.

400

Invalid request.

401

Authentication failed.

403

The user does not have the permission to call this API.

429

There are too many requests.

500

Internal server error.

Error Codes

Table 8 Error codes

HTTP Status Code

Error Code

Description

400

HCSS.14000001

Invalid parameters.

400

HCSS.14000002

CORS service request exception.

400

HCSS.14000003

CBC service request exception.

400

HCSS.14000004

ECS service request exception.

400

HCSS.14000005

EVS service request exception.

400

HCSS.14000006

EIP service request exception.

400

HCSS.14000007

ELB service request exception.

400

HCSS.14000008

IMS service request exception.

400

HCSS.14000009

Marketplace image request exception.

400

HCSS.14000010

Insufficient specifications.

400

HCSS.14000011

Insufficient quota.

429

HCSS.14290001

Too many requests. Try again later.

500

HCSS.15000001

Server exception.

Appendix

This section describes the specification codes of images supported by this API.

For details about the specifications corresponding to the application images and their specification codes supported by the API, see Table 12 and Table 13.
Table 9 Application image specification codes

Image Name

Image Version

Supported Specification Code

BT

6.8.35

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

CRM

8.0

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Ghost

5.67

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

GitLab

16.9.3

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Joomla

5.0.3

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

KodBox

1.49

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Matomo

5.0.3

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Moodle

4.3.4

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Nextcloud

28.0.3

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Nodejs

21

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Odoo

17.0

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Portainer

2.19.4

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

PrestaShop

8.1.5

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Redmine

5.1

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

SRS

6.0.101

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Superset

3.1.1

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

WordPress

6.4

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

For details about the specifications corresponding to the system images and their specification codes supported by the API, see Table 12 and Table 13.

Table 10 System image specification codes

Image Name

Version

Supported Specification Code

Ubuntu

22.04/20.04/18.04/16.04

hf.large.05.30m.linux

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Huawei Cloud EulerOS

2.0

hf.large.025.30m.linux (supported only in the CN-Hong Kong and AP-Singapore regions)

hf.large.05.30m.linux

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

CentOS

8.2/8.1/8.0/7.9/7.8/7.7/7.6/7.5/ 7.4/7.3/7.2

NOTE:

The TR-Istanbul and ME-Riyadh regions do not support 8.2, 8.1, 8.0, 7.3, and 7.2.

hf.large.025.30m.linux (supported only by images of version 7.6 in the CN-Hong Kong and AP-Singapore regions)

hf.large.05.30m.linux

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Debian

11.1/9.0

hf.large.025.30m.linux (supported only by images of version 11.1 in the CN-Hong Kong and AP-Singapore regions)

hf.large.05.30m.linux

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

For details about the specifications corresponding to the private images and their specification codes supported by the API, see Table 12 and Table 13.

Table 11 Private image specification codes

OS

Specifications Code

Linux

hf.large.025.30m.linux

hf.large.05.30m.linux

hf.large.1.30m.linux

hf.large.2.30m.linux

hf.large.4.30m.linux

hf.xlarge.2.30m.linux

hf.xlarge.4.30m.linux

Windows

hf.large.1.30m.byol

hf.large.2.30m.byol

hf.large.4.30m.byol

hf.xlarge.2.30m.byol

hf.xlarge.4.30m.byol

The following table lists the specifications corresponding to the specification codes.

Table 12 Specifications corresponding to the Linux system specification codes

Specifications Code

vCPU

Memory (GiB)

System Disk (GiB)

Peak Bandwidth (Mbit/s)

Data Package (GB)

hf.large.025.30m.linux

2

0.5

20

30

1024

hf.large.05.30m.linux

2

1

40

30

2048

hf.large.1.30m.linux

2

2

60

30

3072

hf.large.2.30m.linux

2

4

80

30

4096

hf.large.4.30m.linux

2

8

160

30

5120

hf.xlarge.2.30m.linux

4

8

240

30

6144

hf.xlarge.4.30m.linux

4

16

320

30

7168

Table 13 Specifications of the Windows system specification codes

Specifications Code

vCPU

Memory (GiB)

System Disk (GiB)

Peak Bandwidth (Mbit/s)

Data Package (GB)

hf.large.1.30m.byol

2

2

60

30

3072

hf.large.2.30m.byol

2

4

80

30

4096

hf.large.4.30m.byol

2

8

160

30

5120

hf.xlarge.2.30m.byol

4

8

240

30

6144

hf.xlarge.4.30m.byol

4

16

320

30

7168