Class BucketsApi

All Implemented Interfaces:
Api<Context>

public class BucketsApi extends AbstractBucketsApi<Context>
  • Constructor Details

    • BucketsApi

      public BucketsApi()
  • Method Details

    • listBuckets

      public void listBuckets(Context ctx, ListBucketsRequest request, Observer<ListBucketsResponse> observer)
      Description copied from class: AbstractBucketsApi
        List buckets
       
      Specified by:
      listBuckets in class AbstractBucketsApi<Context>
    • getBucket

      public void getBucket(Context ctx, GetBucketRequest request, Observer<BucketInfo> observer)
      Description copied from class: AbstractBucketsApi
        Get a bucket
       
      Specified by:
      getBucket in class AbstractBucketsApi<Context>
    • createBucket

      public void createBucket(Context ctx, CreateBucketRequest request, Observer<BucketInfo> observer)
      Description copied from class: AbstractBucketsApi
        Create a bucket
       
      Specified by:
      createBucket in class AbstractBucketsApi<Context>
    • deleteBucket

      public void deleteBucket(Context ctx, DeleteBucketRequest request, Observer<com.google.protobuf.Empty> observer)
      Description copied from class: AbstractBucketsApi
        Delete a bucket
       
        Deleting a bucket means also deleting all objects that are part of it.
       
      Specified by:
      deleteBucket in class AbstractBucketsApi<Context>
    • getObject

      public void getObject(Context ctx, GetObjectRequest request, Observer<HttpBody> observer)
      Description copied from class: AbstractBucketsApi
        Get an object
       
        The body of the response represents the object data. The ``Content-Type``
        header is set to the content type of the object specified when uploading
        the object. If no ``Content-Type`` was specified when creating the object,
        the ``Content-Type`` of the response is set to
        ``application/octet-stream``.
       
      Specified by:
      getObject in class AbstractBucketsApi<Context>
    • uploadObject

      public void uploadObject(Context ctx, UploadObjectRequest request, Observer<com.google.protobuf.Empty> observer)
      Description copied from class: AbstractBucketsApi
        Upload an object
       
        .. rubric:: Simple upload
        
        In case of simple upload, the objectName has to be specified as part of the URL
        and the ``Content-Type header`` has to be set to the type of the object. The body
        of the request is the object data.
        
        
        .. rubric:: Form upload
        
        The form based upload can be used to upload an object from an HTML form. In this
        case the Content-Type of the request is set to ``multipart/form-data``, and the
        body will contain at least one part which is the object data. This part includes
        a filename which is used as the object name as well as a ``Content-Type`` header.
        The name attribute for the file part is ignored.
        Additional parts (which do not specify a filename) will be used as metadata: the
        name is specified as part of the ``Content-Disposition`` and the value is the body
        of the part.
        
        This can be tested with curl using the ``-F`` option.
        
        
        .. rubric:: Example
        .. code-block:: http
        
            POST /api/buckets/_global/my_bucket HTTP/1.1
            Host: localhost:8090
            User-Agent: curl/7.58.0
            Accept: */*
            Content-Length: 1090
            Content-Type: multipart/form-data; boundary=------------------------7109c709802f7ae4
        
            --------------------------7109c709802f7ae4
            Content-Disposition: form-data; name="file"; filename="object/name"
            Content-Type: text/plain
        
            [object data]
            --------------------------7109c709802f7ae4
            Content-Disposition: form-data; name="name1"
        
            value1
            --------------------------7109c709802f7ae4
            Content-Disposition: form-data; name="name2"
        
            value2
            --------------------------7109c709802f7ae4--
        
        
        This will create an object named ``object/name`` with two metadata properties:
        
        .. code-block:: json
        
            {
                "name1": "value1",
                "name2": "value2"
            }
       
      Specified by:
      uploadObject in class AbstractBucketsApi<Context>
    • listObjects

      public void listObjects(Context ctx, ListObjectsRequest request, Observer<ListObjectsResponse> observer)
      Description copied from class: AbstractBucketsApi
        List objects
       
      Specified by:
      listObjects in class AbstractBucketsApi<Context>
    • deleteObject

      public void deleteObject(Context ctx, DeleteObjectRequest request, Observer<com.google.protobuf.Empty> observer)
      Description copied from class: AbstractBucketsApi
        Delete an object
       
      Specified by:
      deleteObject in class AbstractBucketsApi<Context>
    • checkReadBucketPrivilege

      public static void checkReadBucketPrivilege(String bucketName, User user) throws HttpException
      Throws:
      HttpException
    • checkManageBucketPrivilege

      public static void checkManageBucketPrivilege(String bucketName, User user) throws HttpException
      Throws:
      HttpException