Updated on 2025-10-22 GMT+08:00

Authorizing Cloud Storage

Function

This API is used to authorize cloud storage.

URI

POST /v1/{project_id}/cae/volumes

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. See Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

  • Obtain the token. For details, see "Obtaining a User Token" in Identity and Access Management API Reference (https://support.huaweicloud.com/intl/en-us/api-iam/iam_30_0001.html).

  • The value of X-Subject-Token in the response header is the token value.

X-Enterprise-Project-ID

No

String

Enterprise project ID.

  • When an environment is created, it will be bound with an enterprise project ID.

  • Enter 0 or up to 36 characters in UUID format with hyphens (-).

  • If this parameter is not specified or set to 0, resources in the default enterprise project are queried.

NOTE:
For details about how to obtain enterprise project IDs and enterprise project features, see Enterprise Management User Guide.

X-Environment-ID

Yes

String

Environment ID.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

api_version

Yes

String

API version. Fixed value: v1.

kind

Yes

String

API type. Fixed value: Volume.

spec

Yes

VolumeSpec object

Volume specifications.

Table 4 VolumeSpec

Parameter

Mandatory

Type

Description

resource_type

Yes

String

Resource type. Options: obs and sfs.

resource_sub_type

Yes

String

Object storage type.

resources

Yes

Array of strings

Cloud storage name.

resources_credentials

No

Array of ResourcesCredential objects

Cloud storage and authorization credential. This parameter needs to be added when the env_category field in the response of the API for obtaining the environment list is v2.

Table 5 ResourcesCredential

Parameter

Mandatory

Type

Description

access

No

String

User access key. The current access key must have the permission to access the authorized cloud storage.

secret

No

String

User secret key. The current secret key must have the permission to access the authorized cloud storage.

Response Parameters

Status code: 200

OK

None

Example Requests

Authorize cloud storage: Set resource_type to obs and resources to test-bucket.

POST https://{endpoint}/v1/{project_id}/cae/volumes

{
  "api_version" : "v1",
  "kind" : "Volume",
  "spec" : {
    "resource_type" : "obs",
    "resource_sub_type" : "object_bucket",
    "resources" : [ "test-bucket" ],
    "resources_credentials" : [ {
      "access" : "xxx",
      "secret" : "xxx",
      "resources" : [ "test-bucket" ]
    } ]
  }
}

Example Responses

None

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.