Objekte im OCI bucket verschieben

Gerade bin ich wohl über einer meiner Meisterstreiche in Sachen Dokumentation gestolpert. In der oracle cloud lassen sich Objekte nicht einfach verschieben, stattdessen geschieht dies über einen Umweg von Kopier- und Löschvorgängen.

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: https://docs.cloud.oracle.com/en-us/iaas/Content/Object/Tasks/copyingobjects.htm
    (2): documentation of the object_storage_client and its functions:
        https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/object_storage/client/oci.object_storage.ObjectStorageClient.html
    (3): documentation of the Response class and possible attributes:
        https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/request_and_response.html#oci.response.Response
    (4): handling async work requests and their current status:
        https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/workrequests.htm#Asynchronous_Work_Requests
    (5): documentation of the workrequest class
        https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/api/work_requests/models/oci.work_requests.models.WorkRequest.html#oci.work_requests.models.WorkRequest

Kommentar verfassen

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

hungsblog | Nguyen Hung Manh | Dresden
Nach oben scrollen