I want to update only the metadata of an object stored in SoftLayer using the jclouds API. The object already exists so don't want to upload it again.
Asked
Active
Viewed 124 times
0
1 Answers
1
Use a server-side copy to update metadata:
blobStore.copyBlob(containerName, blobName, containerName, blobName, CopyOptions.builder()
.contentMetadata(...)
.userMetadata(...)
.build());

Andrew Gaul
- 2,296
- 1
- 12
- 19
-
hi sir thanks for the reply. But I have The custom Metadata and want to tag the object with that metadata. I want to save the uploading of payload Its as good as POST rather than doing PUT. Plz help me with the solution – nisarga lolage Feb 17 '16 at 07:12
-
Provide a Map to the userMetadata call to tag this data. This will not upload data from the client to the server. – Andrew Gaul Feb 17 '16 at 07:15
-
ByteSource payload = Files.asByteSource(new File(fileName)); blob = blobStore.blobBuilder(fileName) .payload(Payloads.newByteSourcePayload(payload)) .userMetadata(userMetadata).build(); blobStore.putBlob(containerName, blob); This is what I am able to do but it uploads the payload even though the object allready exists on the server. I dont want to upload payload – nisarga lolage Feb 17 '16 at 07:24
-
Call copyBlob, not putBlob. – Andrew Gaul Feb 17 '16 at 07:25
-
blobstore.copyBlob is not present in options so can you please provide the latest relese link – nisarga lolage Feb 17 '16 at 09:25
-
Use jclouds 1.9.1 or later. – Andrew Gaul Feb 17 '16 at 17:05