Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Bravado-based client for GA4GH Data Repository Service (DRS) API services

License

Notifications You must be signed in to change notification settings

elixir-cloud-aai/DRS-cli-legacy

Repository files navigation

DRS-cli

Apache License GitHub: latest tag PyPI PyPI

This repository contains a Bravado-based client for a mockup implementation of the Data Repository Service API schema of the Global Alliance for Genomics and Health, as described in the mock-DRS repository. The client was developed for the use within the TEStribute task distribution logic application.

Usage

To use the client import it as follows in your Python code after installation:

import drs_client

client = drs_client.Client("http://localhost:9101/ga4gh/drs/v1/")

It is possible to supply a Bearer token, which will then be added to the Authentication header (prepended by Bearer) for every outbound call:

client = drs_client.Client(
   url="https://path.to/swagger.json",
   jwt="SomET0kEn"
)

Note that the indicated URL is valid when mock-DRS was installed at the default location on your local machine. When a different DRS instance is supposed to be used, replace the full URL (including http:// or https://).

The DRS GET /objects/{object_id} endpoint can then accessed with, e.g.,:

response = client.GetObject("a001")

Note that all other DRS endpoints are currently not implemented. However, it is possible to populate the DRS database via the mock-DRS POST /update-db endpoint, e.g., with:

response = client.updateDatabaseObjects(
    clear_db=True,
    objects=[
        {
            "access_methods": [
                {
                    "access_id": "string",
                    "access_url": {"headers": ["Authorization"], "url": "string"},
                    "region": "us-east-1",
                    "type": "s3",
                }
            ],
            "aliases": ["string"],
            "checksums": [{"checksum": "string", "type": "string"}],
            "created": "string",
            "description": "string",
            "id": "string",
            "mime_type": "application/json",
            "name": "string",
            "size": 0,
            "updated": "string",
            "version": "string",
        },
    ],
)

The objects list can contain any number of such object entries, and the clear_db parameter indicates whether or not the database should be emptied before adding the specified objects.

For further details on populating the DRS via the POST /update-db endpoint, please see the documentation in the mock-DRS repository.

Installation

You can install DRS-cli in one of two ways:

Installation via package manager

pip install drs_client

or (for development version)

pip install -e git+https://github.com/elixir-europe/DRS-cli.git#egg=drs_client

Manual installation

git clone https://github.com/elixir-europe/DRS-cli.git
cd DRS-cli
python setup.py install

Contributing

This project is a community effort and lives off your contributions, be it in the form of bug reports, feature requests, discussions, or fixes and other code changes. Please read the contributing guidelines if you want to contribute. And please mind the code of conduct for all interactions with the community.

Versioning

Development of the app is currently still in alpha stage, and current versioning is for internal use only. In the future, we are aiming to adopt semantic versioning that is synchronized to the versioning of TEStribute and mock-DRS in order to ensure that these apps will be compatible as long as both their major and minor versions match.

License

This project is covered by the Apache License 2.0 also available shipped with this repository.

Contact

Please contact the project leader for inquiries, proposals, questions etc. that are not covered by the Contributing section.

Acknowledgments

The project is a collaborative effort under the umbrella of the ELIXIR Cloud and AAI group. It was started during the 2019 Google Summer of Code as part of the Global Alliance for Genomics and Health organization.

logo banner

About

Bravado-based client for GA4GH Data Repository Service (DRS) API services

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages