How to move objects between OCI buckets

I just stumbled upon probably one of my best documentation snippets on how to move objects between OCI buckets.

There is no direct "move file" functionality within the oracle cloud. Instead the procedure is to copy the file
to another bucket and delete it in the old one. The copy process is handled asynchronously by a worker which
can be asked about the current status of the request (1). Using the function copy_object (2) also yields a
response object (3) which includes a opc-work-request-id within its headers (not request-id!). This id can be used to ask the worker about its current status using the get_work_request function who in return answers with a
response object (4). Hidden inside this response' data (not header) you can find the current status. We want to wait until the copy actually COMPLETED before deleting the file in the source bucket. Funny enough (4) says that the status for a finished request is SUCCEEDED, while (5) says it is COMPLETED. Printing out the actual status, gives us COMPLETED (10.09.2020) which is used here.

    (1): copying objects in oracle:
    (2): documentation of the object_storage_client and its functions:
    (3): documentation of the Response class and possible attributes:
    (4): handling async work requests and their current status:
    (5): documentation of the workrequest class

Leave a Comment

Your email address will not be published. Required fields are marked *

hungsblog | Nguyen Hung Manh | Dresden
Scroll to Top