Skip to content

Latest commit

 

History

History
99 lines (60 loc) · 2.72 KB

images.rst

File metadata and controls

99 lines (60 loc) · 2.72 KB

Images

List images

compute/v2/images/list_images.php

Each iteration will return an :apiref:Image instance <OpenStack/Compute/v2/Models/Image.html>_.

OpenStack/Compute/v2/Service.html#method_listImages

Detailed information

By default, only the id, links and name attributes are returned. To return all information for an image, you must enable detailed information, like so:

$images = $service->listImages(true);

Retrieve an image

When retrieving an image, sometimes you only want to operate on it - say to update or delete it. If this is the case, then there is no need to perform an initial GET request to the server:

compute/v2/images/get_image.php

OpenStack/Compute/v2/Service.html#method_getImage

If, however, you do want to retrieve all the details of a remote image from the API, you just call:

$image->retrieve();

which will update the state of the local object. This gives you an element of control over your app's performance.

Delete an image

compute/v2/images/delete_image.php

OpenStack/Compute/v2/Models/Image.html#method_delete

Retrieve metadata

This operation will retrieve the existing metadata for an image:

$metadata = $image->getMetadata();

OpenStack/Compute/v2/Models/Image.html#method_getMetadata

Reset metadata

compute/v2/images/reset_image_metadata.php

This operation will _replace all existing metadata with whatever is provided in the request. Any existing metadata not specified in the request will be deleted.

OpenStack/Compute/v2/Models/Image.html#method_resetMetadata

Merge metadata

This operation will _merge specified metadata with what already exists. Existing values will be overriden, new values will be added. Any existing keys that are not specified in the request will remain unaffected.

$image->mergeMetadata([
    'foo' => 'bar',
]);

OpenStack/Compute/v2/Models/Image.html#method_mergeMetadata

Retrieve image metadata item

This operation allows you to retrieve the value for a specific metadata item:

$itemValue = $image->getMetadataItem('key');

OpenStack/Compute/v2/Models/Image.html#method_getMetadataItem

Delete image metadata item

This operation allows you to remove a specific metadata item:

compute/v2/images/delete_image_metadata_item.php

OpenStack/Compute/v2/Models/Image.html#method_deleteMetadataItem