Interface AzureBlobClient

  • All Superinterfaces:
    AutoCloseable, Closeable

    @Path("/")
    public interface AzureBlobClient
    extends Closeable
    Provides access to Azure Blob via their REST API.
    • Method Detail

      • listContainers

        @Named("ListContainers")
        @GET
        BoundedSet<ContainerProperties> listContainers​(ListOptions... listOptions)
        The List Containers operation returns a list of the containers under the specified identity.

        The 2009-07-17 version of the List Containers operation times out after 30 seconds.

        Parameters:
        listOptions - controls the number or type of results requested
        See Also:
        ListOptions
      • createContainer

        @Named("CreateContainer")
        @PUT
        @Path("{container}")
        boolean createContainer​(@PathParam("container")
                                String container,
                                CreateContainerOptions... options)
        The Create Container operation creates a new container under the specified identity. If the container with the same name already exists, the operation fails.

        The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.

        Returns:
        true, if the bucket was created or false, if the container was already present
        See Also:
        CreateContainerOptions
      • getContainerProperties

        @Named("GetContainerProperties")
        @HEAD
        @Path("{container}")
        ContainerProperties getContainerProperties​(@PathParam("container")
                                                   String container)
        The Get Container Properties operation returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs.
      • containerExists

        @Named("GetContainerProperties")
        @HEAD
        @Path("{container}")
        boolean containerExists​(@PathParam("container")
                                String container)
        Issues a HEAD command to determine if the container exists or not.
      • setResourceMetadata

        @Named("SetContainerMetadata")
        @PUT
        @Path("{container}")
        void setResourceMetadata​(@PathParam("container")
                                 String container,
                                 Map<String,​String> metadata)
        The Set Container Metadata operation sets one or more user-defined name/value pairs for the specified container.

        Remarks

        Calling the Set Container Metadata operation overwrites all existing metadata that is associated with the container. It's not possible to modify an individual name/value pair.

        You may also set metadata for a container at the time it is created.

        Calling Set Container Metadata updates the ETag for the container.

      • deleteContainer

        @Named("DeleteContainer")
        @DELETE
        @Path("{container}")
        void deleteContainer​(@PathParam("container")
                             String container)
        The Delete Container operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.

        When a container is deleted, a container with the same name cannot be created for at least 30 seconds; the container may not be available for more than 30 seconds if the service is still processing the request. While the container is being deleted, attempts to create a container of the same name will fail with status code 409 (Conflict), with the service returning additional error information indicating that the container is being deleted. All other operations, including operations on any blobs under the container, will fail with status code 404 (Not Found) while the container is being deleted.

      • createRootContainer

        @Named("CreateContainer")
        @PUT
        @Path("$root")
        boolean createRootContainer​(CreateContainerOptions... options)
        The root container is a default container that may be inferred from a URL requesting a blob resource. The root container makes it possible to reference a blob from the top level of the storage identity hierarchy, without referencing the container name.

        The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.

        See Also:
        CreateContainerOptions
      • getPublicAccessForContainer

        @Named("GetContainerACL")
        @HEAD
        @Path("{container}")
        PublicAccess getPublicAccessForContainer​(@PathParam("container")
                                                 String container)
        Returns whether data in the container may be accessed publicly and the level of access
      • setPublicAccessForContainer

        @Named("SetContainerACL")
        @PUT
        @Path("{container}")
        String setPublicAccessForContainer​(@PathParam("container")
                                           String container,
                                           PublicAccess access)
        Returns whether data in the container may be accessed publicly and the level of access
      • deleteRootContainer

        @Named("DeleteContainer")
        @DELETE
        @Path("$root")
        void deleteRootContainer()
        The Delete Container operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection.

        Remarks

        When a container is deleted, a container with the same name cannot be created for at least 30 seconds; the container may not be available for more than 30 seconds if the service is still processing the request. While the container is being deleted, attempts to create a container of the same name will fail with status code 409 (Conflict), with the service returning additional error information indicating that the container is being deleted. All other operations, including operations on any blobs under the container, will fail with status code 404 (Not Found) while the container is being deleted.
        See Also:
        deleteContainer(String), createRootContainer(CreateContainerOptions...)
      • listBlobs

        @Named("ListBlobs")
        @GET
        @Path("{container}")
        ListBlobsResponse listBlobs​(@PathParam("container")
                                    String container,
                                    ListBlobsOptions... options)
        The List Blobs operation enumerates the list of blobs under the specified container.

        Authorization

        If the container's access control list (ACL) is set to allow anonymous access, any client may call this operation.

        Remarks

        If you specify a value for the maxresults parameter and the number of blobs to return exceeds this value, or exceeds the default value for maxresults, the response body will contain a NextMarker element that indicates the next blob to return on a subsequent request. To return the next set of items, specify the value of NextMarker as the marker parameter on the URI for the subsequent request.

        Note that the value of NextMarker should be treated as opaque.

        The delimiter parameter enables the caller to traverse the blob keyspace by using a user-configured delimiter. The delimiter may be a single character or a string. When the request includes this parameter, the operation returns a BlobPrefix element. The BlobPrefix element is returned in place of all blobs whose keys begin with the same substring up to the appearance of the delimiter character. The value of the BlobPrefix element is substring+delimiter, where substring is the common substring that begins one or more blob keys, and delimiter is the value of the delimiter parameter.

        You can use the value of BlobPrefix to make a subsequent call to list the blobs that begin with this prefix, by specifying the value of BlobPrefix for the prefix parameter on the request URI. In this way, you can traverse a virtual hierarchy of blobs as though it were a file system.

        Note that each BlobPrefix element returned counts toward the maximum result, just as each Blob element does.

        Blobs are listed in alphabetical order in the response body.

      • putBlob

        @Named("PutBlob")
        @PUT
        @Path("{container}/{name}")
        String putBlob​(@PathParam("container")
                       String container,
                       @PathParam("name")
                       AzureBlob object)
        The Put Blob operation creates a new blob or updates the content of an existing blob.

        Updating an existing blob overwrites any existing metadata on the blob. Partial updates are not supported; the content of the existing blob is overwritten with the content of the new blob.

        Remarks

        The maximum upload size for a blob is 256 MB. If your blob is larger than 256 MB, you may upload it as a set of blocks. For more information, see the Put Block and Put Block List operations.

        If you attempt to upload a blob that is larger than 256 MB, the service returns status code 413 (Request Payload Too Large). The Blob service also returns additional information about the error in the response, including the maximum blob size permitted in bytes.

      • getBlob

        @Named("GetBlob")
        @GET
        @Path("{container}/{name}")
        AzureBlob getBlob​(@PathParam("container")
                          String container,
                          @PathParam("name")
                          String name,
                          GetOptions... options)
        The Get Blob operation reads or downloads a blob from the system, including its metadata and properties.
      • putBlock

        @Named("PutBlock")
        @PUT
        @Path("{container}/{name}")
        void putBlock​(@PathParam("container")
                      String container,
                      @PathParam("name")
                      String name,
                      @QueryParam("blockid")
                      String blockId,
                      Payload part)
        The Put Block operation creates a block blob on Azure which can be later assembled into a single, large blob object with the Put Block List operation.
      • putBlockList

        @Deprecated
        @Named("PutBlockList")
        @PUT
        @Path("{container}/{name}")
        String putBlockList​(@PathParam("container")
                            String container,
                            @PathParam("name")
                            String name,
                            List<String> blockIdList)
        Deprecated.
        call putBlockList(String, AzureBlob, List<String>) instead
        The Put Block List assembles a list of blocks previously uploaded with Put Block into a single blob. Blocks are either already committed to a blob or uncommitted. The blocks ids passed here are searched for first in the uncommitted block list; then committed using the "latest" strategy.
      • putBlockList

        @Named("PutBlockList")
        @PUT
        @Path("{container}/{name}")
        String putBlockList​(@PathParam("container")
                            String container,
                            @PathParam("name")
                            AzureBlob object,
                            List<String> blockIdList)
        The Put Block List assembles a list of blocks previously uploaded with Put Block into a single blob. Blocks are either already committed to a blob or uncommitted. The blocks ids passed here are searched for first in the uncommitted block list; then committed using the "latest" strategy.
      • getBlockList

        @Named("GetBlockList")
        @GET
        @Path("{container}/{name}")
        ListBlobBlocksResponse getBlockList​(@PathParam("container")
                                            String container,
                                            @PathParam("name")
                                            String name)
      • getBlobProperties

        @Named("GetBlobProperties")
        @HEAD
        @Path("{container}/{name}")
        BlobProperties getBlobProperties​(@PathParam("container")
                                         String container,
                                         @PathParam("name")
                                         String name)
        The Get Blob Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.
      • setBlobProperties

        @Named("SetBlobProperties")
        @PUT
        @Path("{container}/{name}")
        String setBlobProperties​(@PathParam("container")
                                 String container,
                                 @PathParam("name")
                                 String name,
                                 ContentMetadata contentMetadata)
      • setBlobMetadata

        @Named("SetBlobMetadata")
        @PUT
        @Path("{container}/{name}")
        String setBlobMetadata​(@PathParam("container")
                               String container,
                               @PathParam("name")
                               String name,
                               Map<String,​String> metadata)
      • setBlobTier

        @Named("SetAccessTier")
        @PUT
        @Path("{container}/{name}")
        void setBlobTier​(@PathParam("container")
                         String container,
                         @PathParam("name")
                         String name,
                         @HeaderParam("x-ms-access-tier")
                         AccessTier tier)
      • deleteBlob

        @Named("DeleteBlob")
        @DELETE
        @Path("{container}/{name}")
        void deleteBlob​(@PathParam("container")
                        String container,
                        @PathParam("name")
                        String name)
        The Delete Blob operation marks the specified blob for deletion. The blob is later deleted during garbage collection.
      • blobExists

        @Named("GetBlobProperties")
        @HEAD
        @Path("{container}/{name}")
        boolean blobExists​(@PathParam("container")
                           String container,
                           @PathParam("name")
                           String name)
        Throws:
        ContainerNotFoundException - if the container is not present.
      • copyBlob

        @Named("CopyBlob")
        @PUT
        @Path("{toContainer}/{toName}")
        String copyBlob​(@PathParam("copySource")
                        URI copySource,
                        @PathParam("toContainer")
                        String toContainer,
                        @PathParam("toName")
                        String toName,
                        CopyBlobOptions options)
        Throws:
        ContainerNotFoundException - if the container is not present.