Interface ObjectApi


  • public interface ObjectApi
    Provides access to Object entities via their REST API.
    See Also:
    • Method Detail

      • objectExists

        @Named("Object:Exist")
        @GET
        @Path("storage/v1/b/{bucket}/o/{object}")
        boolean objectExists​(@PathParam("bucket")
                             String bucketName,
                             @PathParam("object") @Encoded
                             String objectName)
        Check the existence of an object
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        Returns:
        a Object true if object exists
      • getObject

        @Named("Object:get")
        @GET
        @Path("storage/v1/b/{bucket}/o/{object}")
        @Consumes("application/json")
        @Nullable
        GoogleCloudStorageObject getObject​(@PathParam("bucket")
                                           String bucketName,
                                           @PathParam("object") @Encoded
                                           String objectName)
        Retrieve an object metadata
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        Returns:
        a Object resource
      • download

        @Named("Object:get")
        @GET
        @Path("storage/v1/b/{bucket}/o/{object}")
        @Nullable
        PayloadEnclosing download​(@PathParam("bucket")
                                  String bucketName,
                                  @PathParam("object") @Encoded
                                  String objectName)
        Retrieve an object or their metadata
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        Returns:
        a Object resource
      • simpleUpload

        @Named("Object:simpleUpload")
        @POST
        @Consumes("application/json")
        @Path("/upload/storage/v1/b/{bucket}/o")
        GoogleCloudStorageObject simpleUpload​(@PathParam("bucket")
                                              String bucketName,
                                              @HeaderParam("Content-Type")
                                              String contentType,
                                              @HeaderParam("Content-Length")
                                              Long contentLength,
                                              Payload payload,
                                              InsertObjectOptions options)
        Stores a new object. Object metadata setting is not supported with simple uploads
        Parameters:
        bucketName - Name of the bucket in which the object to be stored
        options - Supply an InsertObjectOptions. 'name' should not null.
        Returns:
        a GoogleCloudStorageObject
      • deleteObject

        @Named("Object:delete")
        @DELETE
        @Path("storage/v1/b/{bucket}/o/{object}")
        boolean deleteObject​(@PathParam("bucket")
                             String bucketName,
                             @PathParam("object") @Encoded
                             String objectName)
        Deletes an object and its metadata. Deletions are permanent if versioning is not enabled.
        Parameters:
        bucketName - Name of the bucket in which the object to be deleted resides
        objectName - Name of the object
      • deleteObject

        @Named("Object:delete")
        @DELETE
        @Path("storage/v1/b/{bucket}/o/{object}")
        boolean deleteObject​(@PathParam("bucket")
                             String bucketName,
                             @PathParam("object") @Encoded
                             String objectName,
                             DeleteObjectOptions options)
        Deletes an object and its metadata. Deletions are permanent if versioning is not enabled for the bucket, or if the generation parameter is used.
        Parameters:
        bucketName - Name of the bucket in which the object to be deleted resides
        objectName - Name of the object
        options - Supply DeleteObjectOptions with optional query parameters
      • listObjects

        @Named("Object:list")
        @GET
        @Consumes("application/json")
        @Path("storage/v1/b/{bucket}/o")
        ListPageWithPrefixes<GoogleCloudStorageObject> listObjects​(@PathParam("bucket")
                                                                   String bucketName)
        Retrieves a list of objects matching the criteria.
        Parameters:
        bucketName - Name of the bucket in which to look for objects.
      • updateObject

        @Named("Object:update")
        @PUT
        @Consumes("application/json")
        @Produces("application/json")
        @Path("storage/v1/b/{bucket}/o/{object}")
        GoogleCloudStorageObject updateObject​(@PathParam("bucket")
                                              String bucketName,
                                              @PathParam("object") @Encoded
                                              String objectName,
                                              ObjectTemplate objectTemplate)
        Updates an object metadata
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        objectTemplate - Supply an ObjectTemplate
        Returns:
        a GoogleCloudStorageObject
      • patchObject

        @Named("Object:patch")
        @Consumes("application/json")
        @Produces("application/json")
        @Path("storage/v1/b/{bucket}/o/{object}")
        GoogleCloudStorageObject patchObject​(@PathParam("bucket")
                                             String bucketName,
                                             @PathParam("object") @Encoded
                                             String objectName,
                                             ObjectTemplate objectTemplate)
        Updates an object according to patch semantics
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        objectTemplate - Supply ObjectTemplate with optional query parameters
        Returns:
        a GoogleCloudStorageObject
      • patchObject

        @Named("Object:patch")
        @PUT
        @Consumes("application/json")
        @Produces("application/json")
        @Path("storage/v1/b/{bucket}/o/{object}")
        GoogleCloudStorageObject patchObject​(@PathParam("bucket")
                                             String bucketName,
                                             @PathParam("object") @Encoded
                                             String objectName,
                                             ObjectTemplate objectTemplate,
                                             UpdateObjectOptions options)
        Updates an object according to patch semantics
        Parameters:
        bucketName - Name of the bucket in which the object resides
        objectName - Name of the object
        objectTemplate - Supply ObjectTemplate with optional query parameters
        options - Supply UpdateObjectOptions with optional query parameters
        Returns:
        a GoogleCloudStorageObject
      • composeObjects

        @Named("Object:compose")
        @POST
        @Consumes("application/json")
        @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
        GoogleCloudStorageObject composeObjects​(@PathParam("destinationBucket")
                                                String destinationBucket,
                                                @PathParam("destinationObject") @Encoded
                                                String destinationObject,
                                                ComposeObjectTemplate composeObjectTemplate)
        Concatenates a list of existing objects into a new object in the same bucket.
        Parameters:
        destinationBucket - Name of the bucket in which the object to be stored
        destinationObject - The type of upload request.
        composeObjectTemplate - Supply a ComposeObjectTemplate
        Returns:
        a GoogleCloudStorageObject
      • composeObjects

        @Named("Object:compose")
        @POST
        @Consumes("application/json")
        @Path("storage/v1/b/{destinationBucket}/o/{destinationObject}/compose")
        GoogleCloudStorageObject composeObjects​(@PathParam("destinationBucket")
                                                String destinationBucket,
                                                @PathParam("destinationObject") @Encoded
                                                String destinationObject,
                                                ComposeObjectTemplate composeObjectTemplate,
                                                ComposeObjectOptions options)
        Concatenates a list of existing objects into a new object in the same bucket.
        Parameters:
        destinationBucket - Name of the bucket in which the object to be stored
        destinationObject - The type of upload request.
        composeObjectTemplate - Supply a ComposeObjectTemplate
        options - Supply an ComposeObjectOptions
        Returns:
        a GoogleCloudStorageObject
      • copyObject

        @Named("Object:copy")
        @POST
        @Consumes("application/json")
        @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
        GoogleCloudStorageObject copyObject​(@PathParam("destinationBucket")
                                            String destinationBucket,
                                            @PathParam("destinationObject") @Encoded
                                            String destinationObject,
                                            @PathParam("sourceBucket")
                                            String sourceBucket,
                                            @PathParam("sourceObject") @Encoded
                                            String sourceObject)
        Copies an object to a specified location.
        Parameters:
        destinationBucket - Name of the bucket in which to store the new object
        destinationObject - Name of the new object.
        sourceBucket - Name of the bucket in which to find the source object
        sourceObject - Name of the source object
        Returns:
        a GoogleCloudStorageObject
      • copyObject

        @Named("Object:copy")
        @POST
        @Consumes("application/json")
        @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
        GoogleCloudStorageObject copyObject​(@PathParam("destinationBucket")
                                            String destinationBucket,
                                            @PathParam("destinationObject") @Encoded
                                            String destinationObject,
                                            @PathParam("sourceBucket")
                                            String sourceBucket,
                                            @PathParam("sourceObject") @Encoded
                                            String sourceObject,
                                            ObjectTemplate template)
        Copies an object to a specified location with updated metadata.
        Parameters:
        destinationBucket - Name of the bucket in which to store the new object
        destinationObject - Name of the new object.
        sourceBucket - Name of the bucket in which to find the source object
        sourceObject - Name of the source object
        template - Supply a CopyObjectOptions
        Returns:
        a GoogleCloudStorageObject
      • copyObject

        @Named("Object:copy")
        @POST
        @Consumes("application/json")
        @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/copyTo/b/{destinationBucket}/o/{destinationObject}")
        GoogleCloudStorageObject copyObject​(@PathParam("destinationBucket")
                                            String destinationBucket,
                                            @PathParam("destinationObject") @Encoded
                                            String destinationObject,
                                            @PathParam("sourceBucket")
                                            String sourceBucket,
                                            @PathParam("sourceObject") @Encoded
                                            String sourceObject,
                                            CopyObjectOptions options)
        Copies an object to a specified location. Optionally overrides metadata.
        Parameters:
        destinationBucket - Name of the bucket in which to store the new object
        destinationObject - Name of the new object.
        sourceBucket - Name of the bucket in which to find the source object
        sourceObject - Name of the source object
        options - Supply a CopyObjectOptions
        Returns:
        a GoogleCloudStorageObject
      • multipartUpload

        @Named("Object:multipartUpload")
        @POST
        @Consumes("application/json")
        @Path("/upload/storage/v1/b/{bucket}/o")
        GoogleCloudStorageObject multipartUpload​(@PathParam("bucket")
                                                 String bucketName,
                                                 ObjectTemplate objectTemplate,
                                                 Payload payload)
        Stores a new object with metadata.
        Parameters:
        bucketName - Name of the bucket in which the object to be stored
        objectTemplate - Supply an ObjectTemplate.
        Returns:
        a GoogleCloudStorageObject
      • rewriteObjects

        @Named("Object:rewrite")
        @POST
        @Consumes("application/json")
        @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
        RewriteResponse rewriteObjects​(@PathParam("destinationBucket")
                                       String destinationBucket,
                                       @PathParam("destinationObject") @Encoded
                                       String destinationObject,
                                       @PathParam("sourceBucket")
                                       String sourceBucket,
                                       @PathParam("sourceObject") @Encoded
                                       String sourceObject)
        Rewrites a source object to a destination object.
        Parameters:
        destinationBucket - Name of the bucket in which the object to be stored
        destinationObject - Name of the new object.
        sourceBucket - Name of the bucket in which to find the source object.
        sourceObject - Name of the source object.
        Returns:
        a RewriteResponse
      • rewriteObjects

        @Named("Object:rewrite")
        @POST
        @Consumes("application/json")
        @Path("/storage/v1/b/{sourceBucket}/o/{sourceObject}/rewriteTo/b/{destinationBucket}/o/{destinationObject}")
        RewriteResponse rewriteObjects​(@PathParam("destinationBucket")
                                       String destinationBucket,
                                       @PathParam("destinationObject") @Encoded
                                       String destinationObject,
                                       @PathParam("sourceBucket")
                                       String sourceBucket,
                                       @PathParam("sourceObject") @Encoded
                                       String sourceObject,
                                       RewriteObjectOptions options)
        Rewrites a source object to a destination object.
        Parameters:
        destinationBucket - Name of the bucket in which the object to be stored
        destinationObject - Name of the new object.
        sourceBucket - Name of the bucket in which to find the source object.
        sourceObject - Name of the source object.
        options - Supply an RewriteObjectOptions
        Returns:
        a RewriteResponse