Giter Site home page Giter Site logo

icos-object-restorer's Introduction

IBM Cloud Object Storage Archived Objects Restorer

This is a python script that automates the restoration of all archived objects in an IBM Object Storage instance bucket, depending on it's last modified date. The script named "restore_script.py" is the main script, and it should be run with no command line arguments. The script has one limitation. It only restores objects in the same bucket. As a workarround, you can run the script multiple times for diferent buckets

What "restore_script.py" does

  • Reads a "values.env" file, provided by you and in the same diretory, to get the following values

    • API_KEY: Your IBM Cloud API Key
    • COS_ENDPOINT: The endpoint for your COS instance can be found in the configuration tab.
    • BUCKET_NAME: The name of the bucket from which to restore the objects
    • DATE: Archived objects last modified after the specified date are the ones that will be restored
    • DAYS: How many days should the object be restored for
    • TIER: This value must match the archive class of the objects in the bucket. Either "Bulk" for normal archive, or "Accelerated" for accelerated archive
  • Uses the provided API Key to retreive an oauth token

  • Retrieves a list of all the objects in the bucket

  • Selects the desired objects to restore

  • Lastly, it restores those objects

How to use

  • Edit the "example.env" file, replacing the example values with your own.
  • Rename the file to "values.env".
  • Go through the next instructions.

Running as a container

Note: This container uses a bind mount to the script's directory, in order to save the "log" file. Check your OS's and Docker's permissions regarding bind mounts in case of errors

  • Using docker compose

docker-compose up
  • Using docker run

docker build -t <image_name>:<tag> .
docker run -d --rm --name <container_name> --env-file=values.env -v ./:/icos-object-restorer <image_name>:<tag>

Running localy

  • Install dependencies
python -m pip install -r requirements.txt
  • Run
python restore_script.py

icos-object-restorer's People

Contributors

plantaa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.