Help Center/ Scalable File Service/ API Reference/ SFS Turbo APIs/ Directory Management/ Querying the Usage of a File System Directory
Updated on 2024-11-13 GMT+08:00

Querying the Usage of a File System Directory

Function

This API is used to query the usage of a file system directory (including usages of subdirectories). The obtained data may not be the latest as there is a 5-minute delay between the frontend and backend.

Constraints

This API is only supported for file systems created after August 1, 2023. This API is only supported for previous-generation file system types (Standard, Standard-Enhanced, Performance, and Performance-Enhanced). For 1,000 MB/s/TiB, 500 MB/s/TiB, 250 MB/s/TiB, 125 MB/s/TiB, 40 MB/s/TiB, and 20 MB/s/TiB file systems, use the API for creating asynchronous tasks. You are advised not to submit five or more requests at a time, or the file system performance may be affected. It takes a long time to query an oversized directory. Do not submit the request repeatedly.

URI

GET /v1/{project_id}/sfs-turbo/shares/{share_id}/fs/dir-usage

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

share_id

Yes

String

File system ID

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

path

Yes

String

Valid full path of a directory in the file system

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Account token

Content-Type

Yes

String

MIME type, which can be application or json

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-request-id

String

Request ID

Table 5 Response body parameters

Parameter

Type

Description

dir_usage

FsDirUasge object

Message description

Table 6 FsDirUasge

Parameter

Type

Description

used_capacity

Long

Used capacity, in byte

Status code: 400

Table 7 Response header parameters

Parameter

Type

Description

X-request-id

String

Request ID

Table 8 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Status code: 500

Table 9 Response header parameters

Parameter

Type

Description

X-request-id

String

Request ID

Table 10 Response body parameters

Parameter

Type

Description

errCode

String

Error code

errMsg

String

Error description

Example Requests

Querying the directory usage of a Standard file system whose ID is 77ba6f4b-6365-4895-8dda-bc7142af4dde

GET HTTPS://{endpoint}/v1/{project_id}/sfs-turbo/shares/77ba6f4b-6365-4895-8dda-bc7142af4dde/fs/dir-usage

Example Responses

Status code: 200

Directory resource usages

{
  "dir_usage" : {
    "used_capacity" : 1024000
  }
}

Status code: 400

Error response

{
  "errCode" : "SFS.TURBO.0102",
  "errMsg" : "Path is not directory"
}

Status code: 500

Error response

{
  "errCode" : "SFS.TURBO.0005",
  "errMsg" : "Internal server error"
}

Status Codes

Status Code

Description

200

Directory resource usages

400

Error response

500

Error response

Error Codes

See Error Codes.