Obtaining Resource Specifications
Function
This API is used to obtain available resource specifications. This API is used when you need to view or select resource specifications to create resource pools, allocate resources, or learn available resource specifications. Before using this API, ensure that you have the required permissions (such as administrator permissions or resource management permissions). After the API is called, the system returns the resource specifications, including the specification ID, name, number of CPUs, memory size, and storage capacity. If you do not have the required permission or the resource specifications are not configured, the API will return an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v1/{project_id}/resourceflavors
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: N/A Default Value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
continue |
No |
String |
Definition: Offset parameter of the pagination query Constraints: N/A Range: The value is obtained from the metadata.continue field in the response to the last pagination query. An empty value indicates no offset. Default Value: N/A |
|
limit |
No |
Integer |
Definition: Number of resources returned in a single pagination query Constraints: N/A Range: 0 to 500 Default Value: 500 |
|
labelSelector |
No |
String |
Definition: Tag filtering query Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
None
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
Definition: API version of a resource. Range:
|
|
kind |
String |
Definition: Resource type. Range:
|
|
metadata |
metadata object |
Definition: Metadata of a resource flavor list. |
|
items |
Array of ResourceFlavor objects |
Definition: Resource flavor list. Range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
continue |
String |
Definition: Offset parameter of the pagination query. Range: The value is obtained from the metadata.continue field in the response to the last pagination query. An empty value indicates no offset. |
|
remainingItemCount |
Integer |
Definition: Number of remaining resources in a pagination query. Default Value: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
apiVersion |
String |
Definition: API version of a resource. Range:
|
|
kind |
String |
Definition: Resource type. Range:
|
|
metadata |
metadata object |
Definition: Metadata of a resource flavor. |
|
spec |
ResourceFlavorSpec object |
Definition: Specifications of a resource flavor. |
|
status |
ResourceFlavorStatus object |
Definition: Status of a resource flavor. |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Definition: Resource flavor ID. Constraints: N/A Range: N/A Default Value: N/A |
|
labels |
ResourceFlavorLabel object |
Definition: Tags of a resource flavor. |
|
annotations |
ResourceFlavorAnnotation object |
Definition: Comments of a resource flavor. |
|
Parameter |
Type |
Description |
|---|---|---|
|
os.modelarts/scope |
String |
Definition: Job types supported by the resource flavor. Use periods (.) to separate multiple job types. Constraints: N/A Range: N/A Default Value: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
os.modelarts.flavor/image.filter |
String |
Definition: Filter criteria of private images supported by the resource flavor. Constraints: N/A Range: N/A Default Value: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
type |
String |
Definition: Resource flavor type. Range:
[- Logical: logical resource flavor] (tag:hcso) |
|
cpuArch |
String |
Definition: Compute architecture of a resource flavor. Range:
|
|
cpu |
String |
Definition: Number of CPU cores of a resource flavor. Range: N/A |
|
memory |
String |
Definition: Memory size of a resource flavor, in GiB. Range: N/A |
|
gpu |
gpu object |
Definition: GPU resource information of a resource flavor. |
|
npu |
npu object |
Definition: NPU information of a resource flavor. Constraints: N/A Range: N/A Default Value: N/A |
|
dataVolume |
Array of dataVolume objects |
Definition: Storage resource information of a resource flavor. |
|
billingModes |
Array of integers |
Definition: Billing mode supported by a resource flavor. |
|
billingCode |
String |
Definition: Billing code of a resource flavor. Range: N/A |
|
jobFlavors |
Array of strings |
Definition: List of job types supported by a resource flavor. |
|
Parameter |
Type |
Description |
|---|---|---|
|
type |
String |
Definition: Type of GPUs of a resource flavor. Range: N/A |
|
size |
String |
Definition: Number of GPUs of a resource flavor. Range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
type |
String |
Definition: Type of NPUs of a resource flavor. Range: N/A |
|
size |
String |
Definition: Number of NPUs of a resource flavor. Range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
volumeType |
String |
Definition: Disk type. Range:
|
|
size |
String |
Definition: Disk size, in GiB. Range: N/A |
|
Parameter |
Type |
Description |
|---|---|---|
|
phase |
Map<String,String> |
Definition: Capacity status of a resource flavor. The value is in the key-value pair format. The key is the AZ code, and the value is the resource status of the AZ. The options are as follows:
|
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Example Requests
This API is used to obtain resource specifications.
GET https://{endpoint}/v1/{project_id}/resourceflavors
{ }
Example Responses
Status code: 200
OK
{
"kind" : "ResourceFlavorList",
"apiVersion" : "v1",
"metadata" : { },
"items" : [ {
"kind" : "ResourceFlavor",
"apiVersion" : "v1",
"metadata" : {
"name" : "modelarts.vm.cpu8u32g",
"labels" : { }
},
"spec" : {
"cpuArch" : "x86",
"cpu" : "8",
"memory" : "32Gi",
"type" : "Dedicate",
"billingCode" : "modelarts.vm.cpu.8ud",
"billingModes" : [ 0 ]
},
"status" : {
"phase" : {
"cn-north-7a" : "soldout",
"cn-north-7b" : "soldout",
"cn-north-7c" : "normal"
}
}
} ]
}
Status code: 401
Authorization failed.
{
"error_code" : "ModelArts.50001000",
"error_msg" : "token is invalid"
}
Status code: 404
Not found.
{
"error_code" : "ModelArts.50005101",
"error_msg" : "Resourceflavor not found."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
OK |
|
401 |
Authorization failed. |
|
404 |
Not found. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot