Class ImageServiceImpl
- java.lang.Object
-
- org.openstack4j.openstack.internal.BaseOpenStackService
-
- org.openstack4j.openstack.image.internal.BaseImageServices
-
- org.openstack4j.openstack.image.internal.ImageServiceImpl
-
- All Implemented Interfaces:
ImageService,RestService
public class ImageServiceImpl extends BaseImageServices implements ImageService
OpenStack (Glance) Image based Operations- Author:
- Jeremy Unruh
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstack4j.openstack.internal.BaseOpenStackService
BaseOpenStackService.Invocation<R>
-
-
Constructor Summary
Constructors Constructor Description ImageServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddMember(String imageId, String tenantId)Authorize a tenant to access a private imagebooleanaddMember(String imageId, String tenantId, boolean canShare)Authorize a tenant to access a private imageImagecreate(Image image, Payload<?> payload)Creates a new ImageActionResponsedelete(String imageId)Deletes an Image by IDImageget(String imageId)Gets an Image by IDInputStreamgetAsStream(String imageId)Return the image date for the image by IDList<? extends Image>list()Lists public VM images by the default page size defined by openstackList<? extends Image>list(Map<String,String> filteringParams)* Returns list of public VM images filtered by parameters.List<? extends Image>listAll()Lists all public VM imagesList<? extends Image>listAll(Map<String,String> filteringParams)* Returns list of public VM images filtered by parameters when the result greater than the default page size defined by openstackList<? extends CachedImage>listChachedImages()List images currently in the glance image cache.List<? extends ImageMember>listMembers(String imageId)List of the other system tenants that may access a given virtual machine image that the Glance server knows about.booleanremoveMember(String imageId, String tenantId)Revoke a tenant's right to access a private image.Imagereserve(Image image)Reserves a new image to be uploaded later.Imageupdate(Image image)Updates an Image.Imageupload(String imageId, Payload<?> payload, Image image)Upload image data for a previously-reserved image
If an image was previously reserved, and thus is in the queued state, then image data can be added using this method.-
Methods inherited from class org.openstack4j.openstack.internal.BaseOpenStackService
delete, deleteWithResponse, get, getProvider, getServiceVersion, getWithResponse, getXOpenstackRequestId, head, patch, patchWithResponse, post, postWithResponse, put, putWithResponse, request, toList, uri
-
-
-
-
Method Detail
-
listChachedImages
public List<? extends CachedImage> listChachedImages()
List images currently in the glance image cache.- Specified by:
listChachedImagesin interfaceImageService- Returns:
- list of cached images or empty list if the cache is empty or null if the cache is not enabled.
-
list
public List<? extends Image> list()
Lists public VM images by the default page size defined by openstack- Specified by:
listin interfaceImageService- Returns:
- list of images or empty
-
list
public List<? extends Image> list(Map<String,String> filteringParams)
* Returns list of public VM images filtered by parameters.- Specified by:
listin interfaceImageService- Parameters:
filteringParams- map (name, value) of filtering parameters
-
listAll
public List<? extends Image> listAll(Map<String,String> filteringParams)
Description copied from interface:ImageService* Returns list of public VM images filtered by parameters when the result greater than the default page size defined by openstack- Specified by:
listAllin interfaceImageService- Parameters:
filteringParams- map (name, value) of filtering parameters
-
listAll
public List<? extends Image> listAll()
Description copied from interface:ImageServiceLists all public VM images- Specified by:
listAllin interfaceImageService- Returns:
- list of images or empty
-
get
public Image get(String imageId)
Gets an Image by ID- Specified by:
getin interfaceImageService- Parameters:
imageId- the image identifier- Returns:
- the image or null if not found
-
delete
public ActionResponse delete(String imageId)
Deletes an Image by ID- Specified by:
deletein interfaceImageService- Parameters:
imageId- the image identifier- Returns:
- the action response
-
update
public Image update(Image image)
Updates an Image. The image must have the id set or a validation exception will be thrown- Specified by:
updatein interfaceImageService- Parameters:
image- the image to update- Returns:
- the updated image
-
getAsStream
public InputStream getAsStream(String imageId)
Return the image date for the image by ID- Specified by:
getAsStreamin interfaceImageService- Parameters:
imageId- the image identifier- Returns:
- the input stream or null if not found
-
create
public Image create(Image image, Payload<?> payload)
Creates a new Image- Specified by:
createin interfaceImageService- Parameters:
image- the image to createpayload- the payload (image data to upload). Note: if the payload is null thenImageService.reserve(Image)will be called internally- Returns:
- the updated data from the newly stored image
-
reserve
public Image reserve(Image image)
Reserves a new image to be uploaded later. SeeImageService.upload(String, Payload, Image)- Specified by:
reservein interfaceImageService- Parameters:
image- the image to reserve- Returns:
- the updated data from the newly stored image
-
upload
public Image upload(String imageId, Payload<?> payload, @Nullable Image image)
Upload image data for a previously-reserved image
If an image was previously reserved, and thus is in the queued state, then image data can be added using this method. If the image already as data associated with it (e.g. not in the queued state), then you will receive a 409 Conflict exception- Specified by:
uploadin interfaceImageService- Parameters:
imageId- the image identifier of the previously reserved imagepayload- the playload to uploadimage- the optional Image which will be used to update meta data during this transaction
-
listMembers
public List<? extends ImageMember> listMembers(String imageId)
List of the other system tenants that may access a given virtual machine image that the Glance server knows about.- Specified by:
listMembersin interfaceImageService- Parameters:
imageId- the image identifer- Returns:
- List of ImageMember or empty
-
addMember
public boolean addMember(String imageId, String tenantId)
Authorize a tenant to access a private image- Specified by:
addMemberin interfaceImageService- Parameters:
imageId- the image identifiertenantId- the tenant- Returns:
- true if successful
-
addMember
public boolean addMember(String imageId, String tenantId, boolean canShare)
Authorize a tenant to access a private image- Specified by:
addMemberin interfaceImageService- Parameters:
imageId- the image identifiertenantId- the tenantcanShare- both existing and new memberships will have `can_share` set to the provided value- Returns:
- true if successful
-
removeMember
public boolean removeMember(String imageId, String tenantId)
Revoke a tenant's right to access a private image.- Specified by:
removeMemberin interfaceImageService- Parameters:
imageId- the image identifiertenantId- the tenant to remove (identifier)- Returns:
- true if successful
-
-