Interface ContainerApi
-
@Beta @Consumes("application/json") public interface ContainerApi
Provides access to the OpenStack Object Storage (Swift) Container 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 replaceorg.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 Modifier and Type Method Description boolean
create(String containerName)
Creates a container, if not already present.boolean
create(String containerName, CreateContainerOptions options)
Creates a container, if not already present.boolean
deleteIfEmpty(String containerName)
Deletes aContainer
, if empty.boolean
deleteMetadata(String containerName, Map<String,String> metadata)
DeletesContainer
metadata.Container
get(String containerName)
Gets theContainer
.com.google.common.collect.FluentIterable<Container>
list()
Lists up to 10,000 containers.com.google.common.collect.FluentIterable<Container>
list(ListContainerOptions options)
Lists containers with the suppliedListContainerOptions
.void
update(String containerName, UpdateContainerOptions options)
Updates theContainer
.void
updateMetadata(String containerName, Map<String,String> metadata)
Creates or updates theContainer
metadata.
-
-
-
Method Detail
-
list
@Named("container:list") @GET com.google.common.collect.FluentIterable<Container> list()
Lists up to 10,000 containers.NOTE
This method returns a list ofContainer
objects without metadata. To retrieve theContainer
metadata, use theget(String)
method.- Returns:
- a list of
containers
ordered by name.
-
list
@Named("container:list") @GET com.google.common.collect.FluentIterable<Container> list(ListContainerOptions options)
Lists containers with the suppliedListContainerOptions
.NOTE
This method returns a list ofContainer
objects without metadata. To retrieve theContainer
metadata, use theget(String)
method.- Parameters:
options
- the options to control the output list.- Returns:
- a list of
containers
ordered by name.
-
create
@Named("container:create") @PUT @Path("/{containerName}") boolean create(@PathParam("containerName") String containerName)
Creates a container, if not already present.- Parameters:
containerName
- corresponds toContainer.getName()
.- Returns:
true
if the container was created,false
if the container already existed.
-
create
@Named("container:create") @PUT @Path("/{containerName}") boolean create(@PathParam("containerName") String containerName, CreateContainerOptions options)
Creates a container, if not already present.- Parameters:
containerName
- corresponds toContainer.getName()
.options
- the options to use when creating the container.- Returns:
true
if the container was created,false
if the container already existed.
-
get
@Named("container:get") @HEAD @Path("/{containerName}") @Nullable Container get(@PathParam("containerName") String containerName)
Gets theContainer
.- Parameters:
containerName
- corresponds toContainer.getName()
.- Returns:
- the
Container
, ornull
if not found.
-
update
@Named("container:update") @POST @Path("/{containerName}") void update(@PathParam("containerName") String containerName, UpdateContainerOptions options)
Updates theContainer
.- Parameters:
containerName
- the container name corresponding toContainer.getName()
.options
- the container options to update.
-
updateMetadata
@Named("container:updateMetadata") @POST @Path("/{containerName}") void updateMetadata(@PathParam("containerName") String containerName, Map<String,String> metadata)
Creates or updates theContainer
metadata.- Parameters:
containerName
- the container name corresponding toContainer.getName()
.metadata
- the container metadata to create or update.
-
deleteMetadata
@Named("container:deleteMetadata") @POST @Path("/{containerName}") boolean deleteMetadata(@PathParam("containerName") String containerName, Map<String,String> metadata)
DeletesContainer
metadata.- Parameters:
containerName
- corresponds toContainer.getName()
.metadata
- the container metadata to delete.- Returns:
true
if the container metadata was successfully deleted,false
if not.
-
deleteIfEmpty
@Named("container:deleteIfEmpty") @DELETE @Path("/{containerName}") boolean deleteIfEmpty(@PathParam("containerName") String containerName) throws IllegalStateException
Deletes aContainer
, if empty.- Parameters:
containerName
- corresponds toContainer.getName()
.- Returns:
true
if the container was deleted or not present.- Throws:
IllegalStateException
- if the container was not empty.
-
-