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
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
copy(String destinationObject, String sourceContainer, String sourceObject)
Deprecated.call copy(String, String, String, CopyOptions) insteadvoid
copy(String destinationObject, String sourceContainer, String sourceObject, Map<String,String> userMetadata, Map<String,String> objectMetadata)
Deprecated.call copy(String, String, String, Map, Map, CopyOptions) insteadvoid
copy(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.void
copy(String destinationObject, String sourceContainer, String sourceObject, CopyOptions options)
Copies an object from one container to another.void
copyAppendMetadata(String destinationObject, String sourceContainer, String sourceObject, Map<String,String> userMetadata, Map<String,String> objectMetadata)
Deprecated.call copyAppendMetadata(String, String, String, Map, Map, CopyOptions) insteadvoid
copyAppendMetadata(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.void
delete(String objectName)
Deletes an object, if present.boolean
deleteMetadata(String objectName, Map<String,String> metadata)
Deletes the metadata from aSwiftObject
.SwiftObject
get(String objectName)
Gets theSwiftObject
including itsbody
.SwiftObject
get(String objectName, GetOptions options)
Gets theSwiftObject
including itsbody
.SwiftObject
getWithoutBody(String objectName)
Gets theSwiftObject
metadata without itsbody
.ObjectList
list()
Lists up to 10,000 objects.ObjectList
list(ListContainerOptions options)
Lists up to 10,000 objects.String
put(String objectName, Payload payload)
Creates or updates aSwiftObject
.String
put(String objectName, Payload payload, PutOptions options)
Creates or updates aSwiftObject
.void
updateHeaders(String objectName, Map<String,String> metadata)
Creates or updates the metadata for aSwiftObject
without escaping the key.void
updateMetadata(String objectName, Map<String,String> metadata)
Creates or updates the metadata for aSwiftObject
.
-
-
-
Method Detail
-
list
@Consumes("application/json") @Named("object:list") @GET @Nullable ObjectList list()
Lists up to 10,000 objects.- Returns:
- an
ObjectList
ofSwiftObject
ordered 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 themarker
andendMarker
parameters in theListContainerOptions
class.- Parameters:
options
- theListContainerOptions
for controlling the returned list.- Returns:
- an
ObjectList
ofSwiftObject
ordered 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
-options
to control creating theSwiftObject
.- Returns:
SwiftObject.getETag()
of the object.
-
getWithoutBody
@Named("object:getWithoutBody") @HEAD @Path("/{objectName}") @Nullable SwiftObject getWithoutBody(@PathParam("objectName") String objectName)
Gets theSwiftObject
metadata without itsbody
.- Parameters:
objectName
- corresponds toSwiftObject.getName()
.- Returns:
- the
SwiftObject
ornull
, if not found.
-
get
@Named("object:get") @GET @Path("/{objectName}") @Nullable SwiftObject get(@PathParam("objectName") String objectName)
Gets theSwiftObject
including itsbody
.- Parameters:
objectName
- corresponds toSwiftObject.getName()
.- Returns:
- the
SwiftObject
ornull
, if not found.
-
get
@Named("object:get") @GET @Path("/{objectName}") @Nullable SwiftObject get(@PathParam("objectName") String objectName, GetOptions options)
Gets theSwiftObject
including itsbody
.- Parameters:
objectName
- corresponds toSwiftObject.getName()
.options
- options to control the download.- Returns:
- the
SwiftObject
ornull
, 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 aSwiftObject
without 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:
true
if the metadata was successfully deleted,false
if 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.
-
-