Buying a DDM Instance

Function

This API is used to buy a DDM instance.

DDM runs in VPCs. Before buying a DDM instance, ensure that there is a VPC available and the required subnet and security group have been configured.

URI

POST /v1/{project_id}/instances

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Project ID of a tenant in a region

Request

Request parameters

Table 2 Parameter description

Parameter

Mandatory

Type

Description

instance

Yes

Object

Instance information

extend_param

No

Object

Extended parameter, which is available only when you create a yearly/monthly instance.

Table 3 Description of parameter instance

Parameter

Mandatory

Type

Description

name

Yes

String

Name of a DDM instance, which:

  • Consists of 4 to 64 characters.
  • Must start with a letter.
  • Contains only letters, digits, and hyphens (-).

flavor_id

Yes

String

Specification ID.

node_num

Yes

Integer

Number of nodes

engine_id

Yes

String

Engine ID.

enterprise_project_id

No

String

Enterprise project ID

available_zones

Yes

Array

AZ code

The value cannot be empty. For details about how to obtain this parameter value, see Regions and Endpoints.

vpc_id

Yes

String

VPC ID

security_group_id

Yes

String

Security group ID

subnet_id

Yes

String

Subnet ID

param_group_id

No

String

Parameter group ID

Table 4 Description of parameter extend_param

Parameter

Mandatory

Type

Description

charge_mode

No

String

Billing mode. The value can be:

  • prePaid: indicates the yearly/monthly billing mode.
  • postPaid: indicates the pay-per-use billing mode.

Default value: postPaid

period_type

No

String

Subscription period. The value can be:

  • month
  • year

This parameter is mandatory if charge_mode is set to prePaid.

period_num

No

Integer

Subscription duration

  • If period_type is set to month, the value ranges from 1 to 9.
  • If period_type is set to year, the value is 1.

This parameter is mandatory if charge_mode is set to prePaid.

is_auto_renew

No

String

Whether the instance is automatically renewed when it expires. The value can be:

  • true: The instance is automatically renewed when it expires.
  • false: The instance is not automatically renewed when it expires.

This parameter is available if charge_mode is set to prePaid. The instance is automatically renewed by default if no value is specified.

is_auto_pay

No

String

Whether the order is paid from the customer's account balance. The value can be:

  • true: indicates that the order is automatically paid from the customer's account balance.
  • false: indicates that the order needs to be paid manually.

This parameter is available if charge_mode is set to prePaid. The order needs to be paid manually by default if no value is specified.

Response

Response parameters

Table 5 Parameter description

Parameter

Type

Mandatory

Description

id

String

false

Instance ID. This parameter is returned only when a pay-per-use instance is created.

order_id

String

false

Order ID. This parameter is returned when a yearly/monthly instance is created.

Example

Buy a DDM Instance

The following is an example of creating a DDM instance named ddm-test-001.

  • Example request (pay-per-use, without extended parameters)
    {
        "instance": {
            "name": "ddm-test-001",
    	"flavor_id": "a615922f-0ed8-369e-aad4-a595185febba",
    	"node_num": 1,
            "engine_id": "31e09c2f-b38a-39f1-8f5d-dd30a6557475",
            "enterprise_project_id": "0",
            "available_zones": ["az1xahz"],
            "vpc_id":"e1d886ec-cfe7-4cd4-b748-fc55a10b4172",
            "subnet_id":"f942f970-1a02-4eee-8927-e8670ce5a882",
            "security_group_id":"035b70ed-319b-4086-9fd7-62a2e8548b2e"
            }
    }
  • Example request(pay-per-use, with extended parameters)
    {
        "instance": {
            "name": "ddm-test-001",
    	"flavor_id": "a615922f-0ed8-369e-aad4-a595185febba",
    	"node_num": 1,
            "engine_id": "31e09c2f-b38a-39f1-8f5d-dd30a6557475",
            "enterprise_project_id": "0",
            "available_zones": ["az1xahz"],
            "vpc_id":"e1d886ec-cfe7-4cd4-b748-fc55a10b4172",
            "subnet_id":"f942f970-1a02-4eee-8927-e8670ce5a882",
            "security_group_id":"035b70ed-319b-4086-9fd7-62a2e8548b2e"
            },
         "extend_param": {
                   "charge_mode": "postPaid"
        }
    }
  • Example request (yearly/monthly)
    {
        "instance": {
            "name": "ddm-test-001",
    	"flavor_id": "a615922f-0ed8-369e-aad4-a595185febba",
    	"node_num": 1,
            "engine_id": "31e09c2f-b38a-39f1-8f5d-dd30a6557475",
            "enterprise_project_id": "0",
            "available_zones": ["az1xahz"],
            "vpc_id":"e1d886ec-cfe7-4cd4-b748-fc55a10b4172",
            "subnet_id":"f942f970-1a02-4eee-8927-e8670ce5a882",
            "security_group_id":"035b70ed-319b-4086-9fd7-62a2e8548b2e"
            },
        "extend_param": {
            "charge_mode": "prePaid",
            "period_type": "month",
            "period_num": 1,
            "is_auto_renew": "false",
            "is_auto_pay": "true"
    }
    }
  • Example response (pay-per-use)
    {
       "id":"abf441ff-8e5f-4fd4-8199-0b7d44203e65",
       "order_id":"null"
    }
  • Example response (yearly/monthly)
    {
       "id":"null",
       "order_id":"CS1810251738L8VVD"
    }

For failure responses, see Abnormal Request Results.

Status Code

For details, see Status Codes.