Package org.yamcs.http.api
Class BucketsApi
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkManageBucketPrivilege
(String bucketName, User user) static void
checkReadBucketPrivilege
(String bucketName, User user) void
createBucket
(Context ctx, CreateBucketRequest request, Observer<BucketInfo> observer) Create a bucketvoid
deleteBucket
(Context ctx, DeleteBucketRequest request, Observer<com.google.protobuf.Empty> observer) Delete a bucket Deleting a bucket means also deleting all objects that are part of it.void
deleteObject
(Context ctx, DeleteObjectRequest request, Observer<com.google.protobuf.Empty> observer) Delete an objectvoid
getBucket
(Context ctx, GetBucketRequest request, Observer<BucketInfo> observer) Get a bucketvoid
getObject
(Context ctx, GetObjectRequest request, Observer<HttpBody> observer) Get an object The body of the response represents the object data.void
listBuckets
(Context ctx, ListBucketsRequest request, Observer<ListBucketsResponse> observer) List bucketsvoid
listObjects
(Context ctx, ListObjectsRequest request, Observer<ListObjectsResponse> observer) List objectsvoid
uploadObject
(Context ctx, UploadObjectRequest request, Observer<com.google.protobuf.Empty> observer) 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.Methods inherited from class org.yamcs.protobuf.AbstractBucketsApi
callMethod, callMethod, getDescriptorForType, getRequestPrototype, getResponsePrototype
-
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 classAbstractBucketsApi<Context>
-
getBucket
Description copied from class:AbstractBucketsApi
Get a bucket
- Specified by:
getBucket
in classAbstractBucketsApi<Context>
-
createBucket
Description copied from class:AbstractBucketsApi
Create a bucket
- Specified by:
createBucket
in classAbstractBucketsApi<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 classAbstractBucketsApi<Context>
-
getObject
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 classAbstractBucketsApi<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 classAbstractBucketsApi<Context>
-
listObjects
public void listObjects(Context ctx, ListObjectsRequest request, Observer<ListObjectsResponse> observer) Description copied from class:AbstractBucketsApi
List objects
- Specified by:
listObjects
in classAbstractBucketsApi<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 classAbstractBucketsApi<Context>
-
checkReadBucketPrivilege
- Throws:
HttpException
-
checkManageBucketPrivilege
- Throws:
HttpException
-