This API is used to create image metadata.
After the API is successfully invoked, the image metadata is created, but the image file does not exist yet.
POST /v2/images
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
__os_version |
No |
String |
Specifies the image OS version. For the value range, see Values of Related Parameters. If this parameter is not specified, the value Other Linux(64 bit) will be used. In that case, the ECS creation using this image may fail, and the ECS created using this image may fail to run properly. |
visibility |
No |
String |
Specifies whether the image is available to other tenants. The default value is private. When creating image metadata, the value of visibility can be set to private only. |
name |
No |
String |
Specifies the image name. If this parameter is not specified, its value is empty by default. In that case, ECS creation using this image will fail. The name contains 1 to 255 characters. For detailed description, see Image Attributes. This parameter is left blank by default. |
protected |
No |
Boolean |
Specifies whether the image is protected. A protected image cannot be deleted. The default value is false. |
container_format |
No |
String |
Specifies the container format. The default value is bare. |
disk_format |
No |
String |
Specifies the image format. The value can be zvhd2, vhd, zvhd, raw, or qcow2. The default value is zvhd2. |
tags |
No |
Array of strings |
Lists the image tags. The tag contains 1 to 255 characters. The value is left blank by default. |
min_ram |
No |
Integer |
Specifies the minimum memory size (MB) required for running the image. The parameter value depends on ECS specifications. The default value is 0. |
min_disk |
No |
Integer |
Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB. The value of this parameter must be greater than the image system disk capacity. Otherwise, the ECS creation may fail. |
Parameters in the request body are strings of no more than 255 characters, and their values can be left blank. Example:
"key": "value"
POST https://{Endpoint}/v2/images
{ "__os_version": "Ubuntu 14.04 server 64bit", "container_format": "bare", "disk_format": "vhd", "min_disk": 1, "min_ram": 1024, "name": "test", "tags": [ "test", "image" ], "visibility": "private", "protected": false }
Parameter |
Type |
Description |
---|---|---|
visibility |
String |
Specifies whether the image is available to other tenants. The value is private. |
name |
String |
Specifies the image name. If this parameter is not specified, its value is empty by default. In that case, ECS creation using this image will fail. The name contains 1 to 128 characters. For detailed description, see Image Attributes. |
protected |
Boolean |
Specifies whether the image is protected. A protected image cannot be deleted. The value is false. |
container_format |
String |
Specifies the container format. The value is bare. |
disk_format |
String |
Specifies the image format. The value can be zvhd2, vhd, zvhd, raw, or qcow2. The default value is zvhd2. |
tags |
Array of strings |
Lists the image tags. The tag contains 1 to 255 characters. |
min_ram |
Integer |
Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications limit. The value is generally set to 0. |
min_disk |
Integer |
Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB. It must be greater than the system disk capacity in the image. Otherwise, the ECS creation may fail. |
status |
String |
Specifies the image status. The value can be one of the following:
|
created_at |
String |
Specifies the time when the image was created. The value is in UTC format. |
updated_at |
String |
Specifies the time when the image was updated. The value is in UTC format. |
self |
String |
Specifies the image URL. |
id |
String |
Specifies the image ID. After the image creation API is called, the image ID must be saved. The image ID is used to invoke the image uploading API and upload the image. |
file |
String |
Specifies the URL for uploading and downloading the image file. |
schema |
String |
Specifies the URL for accessing the schema. |
__image_source_type |
String |
Specifies the image backend storage type. Only UDS is supported currently. |
__image_size |
String |
Specifies the image size. The unit is byte. |
__isregistered |
String |
Specifies whether the image is registered. Only registered images can be queried on the portal. The value is true. |
__os_version |
String |
Specifies the image OS version. For the value range, see Values of Related Parameters. |
__os_type |
String |
Specifies the image OS type. The value of this parameter depends on that of __os_version. The value can be Windows, Linux, or other. |
__platform |
String |
Specifies the OS platform supported by the image. The value of this parameter depends on that of __os_version. |
__os_bit |
String |
Specifies the OS bit. The value of this parameter depends on that of __os_version. The value can be 32 or 64. |
__imagetype |
String |
Specifies the image type. private indicates a private image. |
virtual_env_type |
String |
Specifies the platform type. Specifies the environment where the image is used. The value can be FusionCompute, Ironic, DataImage, or IsoImage.
|
owner |
String |
Specifies the ID of the project to which the image belongs. |
__root_origin |
String |
Specifies that the image is created from an external image file. Value: file |
checksum |
String |
Specifies the MD5 value of the image file. |
size |
Long |
This parameter is unavailable currently. |
virtual_size |
Integer |
Specifies the virtual size of the image. The unit is byte. |
properties |
Properties object |
Specifies a collection of image attributes instead of a specified attribute. |
STATUS CODE 201
{ "schema": "/v2/schemas/image", "min_disk": 1, "created_at": "2016-06-02T07:49:48Z", "__image_source_type": "uds", "container_format": "bare", "__image_size": "0", "file": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86/file", "updated_at": "2016-06-02T07:49:49Z", "protected": false, "id": "4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86", "__isregistered": "true", "min_ram": 1024, "owner": "b912fb4a4c464b568ecfca1071b21b10", "__os_type": "Linux", "__imagetype": "private", "visibility": "private", "virtual_env_type": "FusionCompute", "tags": [ "test", "image" ], "__platform": "Ubuntu", "__os_bit": "64", "__os_version": "Ubuntu 14.04 server 64bit", "name": "test", "self": "/v2/images/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba86", "disk_format": "vhd", "status": "queued" }
Returned Value |
Description |
---|---|
400 Bad Request |
Request error. |
401 Unauthorized |
Authentication failed. |
403 Forbidden |
You do not have the rights to perform the operation. |
404 Not Found |
The requested resource was not found. |
500 Internal Server Error |
Internal service error. |
503 Service Unavailable |
The service is unavailable. |