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 replace
org.jclouds.openstack.swift.SwiftClient in jclouds 2.0 and it is recommended you adopt it sooner than later.-
Method Summary
Modifier and TypeMethodDescriptionbooleanCreates a container, if not already present.booleancreate(String containerName, CreateContainerOptions options) Creates a container, if not already present.booleandeleteIfEmpty(String containerName) Deletes aContainer, if empty.booleandeleteMetadata(String containerName, Map<String, String> metadata) DeletesContainermetadata.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.voidupdate(String containerName, UpdateContainerOptions options) Updates theContainer.voidupdateMetadata(String containerName, Map<String, String> metadata) Creates or updates theContainermetadata.
-
Method Details
-
list
Lists up to 10,000 containers.NOTE
This method returns a list ofContainerobjects without metadata. To retrieve theContainermetadata, use theget(String)method.- Returns:
- a list of
containersordered 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 ofContainerobjects without metadata. To retrieve theContainermetadata, use theget(String)method.- Parameters:
options- the options to control the output list.- Returns:
- a list of
containersordered 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:
trueif the container was created,falseif 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:
trueif the container was created,falseif 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, ornullif 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 theContainermetadata.- 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) DeletesContainermetadata.- Parameters:
containerName- corresponds toContainer.getName().metadata- the container metadata to delete.- Returns:
trueif the container metadata was successfully deleted,falseif 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:
trueif the container was deleted or not present.- Throws:
IllegalStateException- if the container was not empty.
-