Obtaining Virtual Resource Flavors

Function

This API is used to obtain virtual resource flavors.

URI

GET /v1/{project_id}/virtualresourceflavors

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

apiVersion

String

API version. The options are as follows:

  • v1

kind

String

Resource type. The options are as follows:

  • ResourceFlavorList: resource flavors

metadata

ResourceFlavorListMetadata object

Metadata of resource flavors.

items

Array of ResourceFlavor objects

Resource flavors.

Table 3 ResourceFlavorListMetadata

Parameter

Type

Description

continue

String

Next query position in pagination query.

remainingItemCount

Integer

Remaining resources.

Table 4 ResourceFlavor

Parameter

Type

Description

apiVersion

String

API version. The options are as follows:

  • v1

kind

String

Resource type. The options are as follows:

  • ResourceFlavor: resource flavor

metadata

ResourceFlavorMetadata object

Metadata of a resource flavor.

spec

ResourceFlavorSpec object

Description of a resource flavor.

Table 5 ResourceFlavorMetadata

Parameter

Type

Description

name

String

Resource flavor name.

Table 6 ResourceFlavorSpec

Parameter

Type

Description

type

String

Virtual resource flavor type.

cpuArch

String

Computer architecture. The options are as follows:

  • x86

  • arm64

cpu

String

Number of CPU cores.

memory

String

Memory size in GiB.

npu

ResourceFlavorXpu object

Virtual NPU information.

virtualResourceTemplateName

String

Template name of the virtual NPU resource corresponding to the resource flavor.

Table 7 ResourceFlavorXpu

Parameter

Type

Description

type

String

Virtual NPU allocation type, which corresponds to the queried virtual resource template.

size

String

Size. The value is 1.

resourceKey

String

Resource key for virtual NPU allocation

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Obtain virtual NPU allocation resource flavors.

GET https://{endpoint}/v1/{project_id}/virtualresourceflavors

Example Responses

Status code: 200

OK.

{
  "kind" : "ResourceFlavorList",
  "apiVersion" : "v1",
  "metadata" : { },
  "items" : [ {
    "kind" : "ResourceFlavor",
    "apiVersion" : "v1",
    "metadata" : {
      "name" : "snt9-280t-vir10-3c-16g",
      "labels" : { }
    },
    "spec" : {
      "cpuArch" : "arm64",
      "cpu" : "8",
      "memory" : "32Gi",
      "type" : "Logical",
      "virtualResourceTemplateName" : "snt9-280t",
      "visibility" : "invisible"
    }
  } ]
}

Status code: 404

Not found.

{
  "error_code" : "ModelArts.50005101",
  "error_msg" : "VirtualResourceTemplate {name} not found."
}

Status Codes

Status Code

Description

200

OK.

404

Not found.

Error Codes

See Error Codes.