This topic describes how to create a unit resource specification by using the API.
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| name | string | Yes | s1 | The name of the resource specification to be created. |
| memory_size | string | Yes | 5G | The memory specification. The minimum value is controlled by the hidden parameter __min_full_resource_pool_memory (the default value is 5G). To ensure system stability, we recommend that you set the minimum value to 4G. |
| max_cpu | float64 | Yes | 2 | The upper limit of the CPU specification. The minimum value is 1, which indicates 1 core. |
| min_cpu | float64 | No | 2 | The lower limit of the CPU specification. The minimum value is 1, which indicates 1 core. If this parameter is not specified, the value of min_cpu is the same as that of max_cpu. |
| max_iops | int | No | 1024 | The upper limit of IOPS. The minimum value is 1024. The configured value must be greater than or equal to the value of min_iops. If this parameter is not specified, the system automatically calculates the value of max_iops based on the following rules:
|
| min_iops | int | No | 1024 | The lower limit of IOPS. The minimum value is 1024. If this parameter is not specified, the system automatically calculates the value of min_iops based on the following rules:
|
| log_disk_size | string | No | 15G | The size of the tenant log disk space. If this parameter is not specified, the value is 3 times the memory specification, with a minimum value of 2G. |
Return result
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request is successful. |
| timestamp | time.Time | The timestamp when the server processes the request. |
| duration | int | The time (in milliseconds) taken by the server to process the request. |
| status | int | The HTTP status code. |
| traceId | string | The Trace ID of the request. |
| error | ApiError | The error generated by the request, which contains the following information:
|
Examples
Request example
{
"name":"s1",
"memory_size": "5GB",
"max_cpu": 3,
}
Response example
{
"successful": true,
"timestamp": "2024-09-24T19:59:04.310305176+08:00",
"duration": 10,
"status": 200,
"traceId": "7d9bd52cc65cd449"
}
References
You can also call the API by using SDK methods.
For more information about how to call the API by using obshell-sdk-python, see Create a resource specification.
For more information about how to call the API by using obshell-sdk-go, see Create a resource specification.