Adding a Custom Image Version
Function
This API is used to add a new version to a registered image. This API is synchronous and works with the Registering a Custom Image API for image version management.
Calling Method
For details, see Calling APIs.
URI
POST /v2/images/{image_id}/versions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| image_id | Yes | String | Definition: Image ID. You can obtain the image ID by calling the Listing Custom Images API. Constraints: N/A Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition: User token. It is obtained by calling the Obtaining an IAM User Token API. Constraints: N/A Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| image_url | Yes | String | Definition: URL of the custom image, consisting of the image registry address, image namespace, image name, and image version. Constraints: N/A Range: 1 to 2,000 characters. Container image address consisting of letters, digits, periods (.), slashes (/), colons (:), underscores (_), and hyphens (-). Default Value: N/A |
| category | Yes | String | Definition: Custom image category. Constraints: N/A Range Default Value: N/A |
| architectures | No | Array of strings | Definition: Architecture list supported by the image. The values are x86_64 (x86 architecture) and aarch64 (Arm architecture). If this parameter is not specified, the default value is x86_64. Constraints: N/A |
| type | Yes | String | Definition: Version type. Constraints: N/A Range Default Value: N/A |
| container_softwares | No | Array of ContainerSoftware objects | Definition: Software list included in the custom image. Each element is a ContainerSoftware object containing the software name and version. Constraints: 0 to 100 software items. |
| description | No | String | Definition: Description of the custom image. Constraints: N/A Range: 0 to 2,000 characters. Exclamation marks (!), less-than signs (<), greater-than signs (>), equal signs (=), ampersands (&), double quotation marks ("), single quotation marks ('), at signs (@), number signs (#), percent signs (%), semicolons (;), left parentheses ((), right parentheses ()), vertical bars (|), asterisks (*), and backslashes () are not allowed. Default Value: N/A |
| base_image_id | No | String | Definition: Base image ID. The ID can be obtained by calling the Listing Custom Images API. Constraints: This parameter is mandatory for Spark images. Range: 0 to 64 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| base_image_version_id | No | String | Definition: Base image version ID. The ID can be obtained by calling the Listing Custom Image Versions API. Constraints: This parameter is mandatory for Spark images. Range: 0 to 64 characters. Only letters, digits, and hyphens (-) are allowed. Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition: Software name. Constraints: N/A Range: 2 to 32 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. Default Value: N/A |
| version | Yes | String | Definition: Software version. Constraints: N/A Range: 2 to 32 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. Default Value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| version_id | String | Definition: Image version ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_version | String | Definition: Image version. Range: 2 to 32 characters. Only letters, digits, periods (.), slashes (/), colons (:), underscores (_), and hyphens (-) are allowed. |
| category | String | Definition: Image category. Range |
| image_registry | String | Definition: Image domain name. Range: 0 to 255 characters. Only letters, digits, periods (.), and hyphens (-) are allowed. |
| image_namespace | String | Definition: Image namespace. Range: 0 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
| image_name | String | Definition: Image name. Range: 0 to 128 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
| architectures | Array of strings | Definition: List of supported image architectures. Available values: x86_64 (x86 architecture) and aarch64 (Arm architecture). |
| container_softwares | Array of ContainerSoftware objects | Definition: Image software list, where each element is a ContainerSoftware object containing the software name and version. |
| status | String | Definition: Image version status. Range |
| type | String | Definition: Image version type. Range |
| visibility | String | Definition: Image version visibility. Range |
| create_time | String | Definition: Custom image version creation time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
| update_time | String | Definition: Custom image version update time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
| description | String | Definition: Image version description. Range: 0 to 2,000 characters. Only letters, digits, and common symbols are allowed. Characters such as exclamation mark (!), less-than sign (<), greater-than sign (>), equal sign (=), ampersand (&), double quotation marks ("), and single quotation marks (') are not allowed. |
| base_image_id | String | Definition: ID of the associated preset base image. Range: 0 to 64 characters. Only letters, digits, and hyphens (-) are allowed. |
| base_image_version_id | String | Definition: Version ID of the associated preset base image. Range: 0 to 64 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_snapshot | V2ImageSnapshotInfo object | Definition: Matched image snapshot information. If no snapshot is matched, null is returned. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition: Software name. Range: 2 to 32 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. |
| version | String | Definition: Software version. Range: 2 to 32 characters. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition: Image snapshot record ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_id | String | Definition: Image ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| image_version_id | String | Definition: Image version ID. Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed. |
| name | String | Definition: Image snapshot name (user-specified). Range: 1 to 190 characters. Only lowercase letters, digits, and hyphens (-) are allowed. It must start with a lowercase letter and end with a lowercase letter or digit. |
| image_address | String | Definition: Full image address (including registry/namespace/name:version). Range: 0 to 1,024 characters. Only letters, digits, periods (.), colons (:), slashes (/), and hyphens (-) are allowed. |
| image_name | String | Definition: Image name. Range: 0 to 128 characters. Only letters, digits, periods (.), slashes (/), colons (:), underscores (_), and hyphens (-) are allowed. |
| image_version | String | Definition: Image version. Range: 0 to 1,024 characters. Only letters, digits, periods (.), colons (:), underscores (_), and hyphens (-) are allowed. |
| status | String | Definition: Image snapshot status. Range |
| image_snapshot_size | Integer | Definition: Snapshot size, in GiB. Range: 20 to 400. |
| creation_mode | String | Definition: Creation method. Range |
| reserved_days | Integer | Definition: Image snapshot retention period, in days. The snapshot automatically expires after the retention period. 0 indicates permanent retention. Range: 0 to 65,536. |
| expire_time | String | Definition: Image snapshot expiration time. A null value indicates permanent validity. The time is in UTC, in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSSXXX), for example, 2025-01-10T03:37:12.000+00:00. Range: N/A |
| failed_message | String | Definition: Message indicating why the image snapshot is invalid. Range: 0 to 65,535 characters. Only letters, digits, and common symbols are allowed. |
| create_time | String | Definition: Creation time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
| update_time | String | Definition: Update time, in UTC format, ISO 8601: yyyy-MM-dd'T'HH:mm:ss.SSSXXX. Example: 2025-01-10T03:37:12.000+00:00. Range: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Range: 8 to 36 characters. |
| error_msg | String | Definition: Error description. Range: 2 to 512 characters. |
| solution_msg | String | Definition: Solution. Range: 0 to 4,096 characters. |
Example Requests
Add a new version to an existing image.
POST /v2/images/{image_id}/versions
{
"image_url" : "swr.cn-north-4.myhuaweicloud.com/test-image/spark_job:v1",
"category" : "SPARK_JOB",
"type" : "STABLE",
"architectures" : [ "x86_64" ],
"container_softwares" : [ {
"name" : "jdk",
"version" : "21"
} ],
"description" : "test image",
"base_image_id" : "2b5633ba2b904511ad514346f4d23d4b",
"base_image_version_id" : "3c6744cb3c015622be65457a5e34de5c"
} Example Responses
Status code: 200
{
"version_id" : "c2533937-101d-4a5b-9c8d-03c2ee815f1d",
"image_version" : "v1",
"category" : "SPARK_JOB",
"image_registry" : "swr.cn-north-4.myhuaweicloud.com",
"image_namespace" : "test-image",
"image_name" : "spark_job",
"architectures" : [ "x86_64" ],
"container_softwares" : [ {
"name" : "jdk",
"version" : "21"
} ],
"status" : "AVAILABLE",
"type" : "STABLE",
"visibility" : "PRIVATE",
"create_time" : "2025-01-10T03:37:12.000+00:00",
"update_time" : "2025-01-10T03:37:12.000+00:00",
"description" : "test image"
} Status code: 400
{
"error_code" : "AIDataLake.00010151",
"error_msg" : "Parameter value is invalid.",
"solution_msg" : "Please input valid parameter value."
} Status code: 401
{
"error_code" : "APIGW.0301",
"error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
"solution_msg" : "Check whether the IAM authentication information is correct."
} Status code: 403
{
"error_code" : "AIDataLake.00010150",
"error_msg" : "The operation is not allowed.",
"solution_msg" : "Check whether the operation is allowed in the current status."
} Status code: 404
{
"error_code" : "AIDataLake.00010009",
"error_msg" : "No resources found.",
"solution_msg" : "Ensure the requested resource exists and the parameters are correct."
} Status code: 500
{
"error_code" : "AIDataLake.00011001",
"error_msg" : "Internal error.",
"solution_msg" : "Contact technical support or try again later."
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Invalid request parameters. |
| 401 | Unauthorized. |
| 403 | Access denied. |
| 404 | Resource not found. |
| 500 | Internal server error. |
What is your overall rating for this page?
Thank 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