Interface ObjectApi
@Beta
public interface ObjectApi
Provides access to the OpenStack Object Storage (Swift) Object API features.
This API is new to jclouds and hence is in Beta. That means we need people to use it and give us feedback. Based
on that feedback, minor changes to the interfaces may happen. This code will replace
org.jclouds.openstack.swift.SwiftClient in jclouds 2.0 and it is recommended you adopt it sooner than later.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.call copy(String, String, String, CopyOptions) insteadvoidcopy(String destinationObject, String sourceContainer, String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata) Deprecated.call copy(String, String, String, Map, Map, CopyOptions) insteadvoidcopy(String destinationObject, String sourceContainer, String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata, CopyOptions options) Copies an object from one container to another, replacing metadata.voidcopy(String destinationObject, String sourceContainer, String sourceObject, CopyOptions options) Copies an object from one container to another.voidcopyAppendMetadata(String destinationObject, String sourceContainer, String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata) Deprecated.call copyAppendMetadata(String, String, String, Map, Map, CopyOptions) insteadvoidcopyAppendMetadata(String destinationObject, String sourceContainer, String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata, CopyOptions options) Copies an object from one container to another, appending metadata.voidDeletes an object, if present.booleandeleteMetadata(String objectName, Map<String, String> metadata) Deletes the metadata from aSwiftObject.Gets theSwiftObjectincluding itsbody.get(String objectName, GetOptions options) Gets theSwiftObjectincluding itsbody.getWithoutBody(String objectName) Gets theSwiftObjectmetadata without itsbody.list()Lists up to 10,000 objects.list(ListContainerOptions options) Lists up to 10,000 objects.Creates or updates aSwiftObject.put(String objectName, Payload payload, PutOptions options) Creates or updates aSwiftObject.voidupdateHeaders(String objectName, Map<String, String> metadata) Creates or updates the metadata for aSwiftObjectwithout escaping the key.voidupdateMetadata(String objectName, Map<String, String> metadata) Creates or updates the metadata for aSwiftObject.
-
Method Details
-
list
Lists up to 10,000 objects.- Returns:
- an
ObjectListofSwiftObjectordered by name ornull.
-
list
@Consumes("application/json") @Named("object:list") @GET @Nullable ObjectList list(ListContainerOptions options) Lists up to 10,000 objects. To control a large list of containers beyond 10,000 objects, use themarkerandendMarkerparameters in theListContainerOptionsclass.- Parameters:
options- theListContainerOptionsfor controlling the returned list.- Returns:
- an
ObjectListofSwiftObjectordered by name ornull.
-
put
@Named("object:put") @PUT @Path("/{objectName}") String put(@PathParam("objectName") String objectName, Payload payload) Creates or updates aSwiftObject.- Parameters:
objectName- corresponds toSwiftObject.getName().payload- corresponds toSwiftObject.getPayload().- Returns:
SwiftObject.getETag()of the object.
-
put
@Named("object:put") @PUT @Path("/{objectName}") String put(@PathParam("objectName") String objectName, Payload payload, PutOptions options) Creates or updates aSwiftObject.- Parameters:
objectName- corresponds toSwiftObject.getName().payload- corresponds toSwiftObject.getPayload().options-optionsto control creating theSwiftObject.- Returns:
SwiftObject.getETag()of the object.
-
getWithoutBody
@Named("object:getWithoutBody") @HEAD @Path("/{objectName}") @Nullable SwiftObject getWithoutBody(@PathParam("objectName") String objectName) Gets theSwiftObjectmetadata without itsbody.- Parameters:
objectName- corresponds toSwiftObject.getName().- Returns:
- the
SwiftObjectornull, if not found.
-
get
@Named("object:get") @GET @Path("/{objectName}") @Nullable SwiftObject get(@PathParam("objectName") String objectName) Gets theSwiftObjectincluding itsbody.- Parameters:
objectName- corresponds toSwiftObject.getName().- Returns:
- the
SwiftObjectornull, if not found.
-
get
@Named("object:get") @GET @Path("/{objectName}") @Nullable SwiftObject get(@PathParam("objectName") String objectName, GetOptions options) Gets theSwiftObjectincluding itsbody.- Parameters:
objectName- corresponds toSwiftObject.getName().options- options to control the download.- Returns:
- the
SwiftObjectornull, if not found.
-
updateMetadata
@Named("object:updateMetadata") @POST @Path("/{objectName}") @Produces("") void updateMetadata(@PathParam("objectName") String objectName, Map<String, String> metadata) Creates or updates the metadata for aSwiftObject.- Parameters:
objectName- corresponds toSwiftObject.getName().metadata- the metadata to create or update.
-
updateHeaders
@Named("object:updateMetadata") @POST @Path("/{objectName}") @Produces("") void updateHeaders(@PathParam("objectName") String objectName, Map<String, String> metadata) Creates or updates the metadata for aSwiftObjectwithout escaping the key. This will also update metadata such as content-disposition.- Parameters:
objectName- corresponds toSwiftObject.getName().metadata- the metadata to create or update.
-
deleteMetadata
@Named("object:deleteMetadata") @POST @Path("/{objectName}") boolean deleteMetadata(@PathParam("objectName") String objectName, Map<String, String> metadata) Deletes the metadata from aSwiftObject.- Parameters:
objectName- corresponds toSwiftObject.getName().metadata- corresponds toSwiftObject.getMetadata().- Returns:
trueif the metadata was successfully deleted,falseif not.
-
delete
@Named("object:delete") @DELETE @Path("/{objectName}") void delete(@PathParam("objectName") String objectName) Deletes an object, if present.- Parameters:
objectName- corresponds toSwiftObject.getName().
-
copy
@Deprecated @Named("object:copy") @PUT @Path("/{destinationObject}") void copy(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject) Deprecated.call copy(String, String, String, CopyOptions) insteadCopies an object from one container to another.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-
copy
@Named("object:copy") @PUT @Path("/{destinationObject}") void copy(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject, CopyOptions options) Copies an object from one container to another.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.options- conditional copy- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-
copy
@Deprecated @Named("object:copy") @PUT @Path("/{destinationObject}") void copy(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata) Deprecated.call copy(String, String, String, Map, Map, CopyOptions) insteadCopies an object from one container to another, replacing metadata.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.userMetadata- Freeform metadata for the object, automatically prefixed/escapedobjectMetadata- Unprefixed/unescaped metadata, such as Content-Disposition- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-
copy
@Named("object:copy") @PUT @Path("/{destinationObject}") void copy(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata, CopyOptions options) Copies an object from one container to another, replacing metadata.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.userMetadata- Freeform metadata for the object, automatically prefixed/escapedobjectMetadata- Unprefixed/unescaped metadata, such as Content-Dispositionoptions- conditional copy- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-
copyAppendMetadata
@Deprecated @Named("object:copy") @PUT @Path("/{destinationObject}") void copyAppendMetadata(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata) Deprecated.call copyAppendMetadata(String, String, String, Map, Map, CopyOptions) insteadCopies an object from one container to another, appending metadata.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.userMetadata- Freeform metadata for the object, automatically prefixed/escapedobjectMetadata- Unprefixed/unescaped metadata, such as Content-Disposition- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-
copyAppendMetadata
@Named("object:copy") @PUT @Path("/{destinationObject}") void copyAppendMetadata(@PathParam("destinationObject") String destinationObject, @PathParam("sourceContainer") String sourceContainer, @PathParam("sourceObject") String sourceObject, Map<String, String> userMetadata, Map<String, String> objectMetadata, CopyOptions options) Copies an object from one container to another, appending metadata.NOTE
This is a server side copy.- Parameters:
destinationObject- the destination object name.sourceContainer- the source container name.sourceObject- the source object name.userMetadata- Freeform metadata for the object, automatically prefixed/escapedobjectMetadata- Unprefixed/unescaped metadata, such as Content-Dispositionoptions- conditional copy- Throws:
KeyNotFoundException- if the source or destination container do not exist.
-