swh.deposit.api.private package

Submodules

swh.deposit.api.private.deposit_check module

class swh.deposit.api.private.deposit_check.SWHChecksDeposit[source]

Bases: swh.deposit.api.common.SWHGetDepositAPI, swh.deposit.api.common.SWHPrivateAPIView, swh.deposit.api.private.DepositReadMixin

Dedicated class to read a deposit’s raw archives content.

Only GET is supported.

process_get(req, collection_name, deposit_id)[source]
Build a unique tarball from the multiple received and stream that
content to the client.
Parameters:
  • req (Request) –
  • collection_name (str) – Collection owning the deposit
  • deposit_id (id) – Deposit concerned by the reading
Returns:

Tuple status, stream of content, content-type

swh.deposit.api.private.deposit_list module

class swh.deposit.api.private.deposit_list.DefaultPagination[source]

Bases: rest_framework.pagination.PageNumberPagination

page_size = 100
page_size_query_param = 'page_size'
class swh.deposit.api.private.deposit_list.StatusDetailField(*args, **kwargs)[source]

Bases: rest_framework.fields._UnvalidatedField

status_detail field is a dict, we want a simple message instead. So, we reuse the convert_status_detail from deposit_status endpoint to that effect.

to_representation(value)[source]

Transform the outgoing native value into primitive data.

class swh.deposit.api.private.deposit_list.DepositSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of swh.deposit.models.Deposit

fields = '__all__'
class swh.deposit.api.private.deposit_list.DepositList(**kwargs)[source]

Bases: rest_framework.generics.ListAPIView, swh.deposit.api.common.SWHPrivateAPIView

Deposit request class to list the deposit’s status per page.

HTTP verbs supported: GET

queryset
serializer_class

alias of DepositSerializer

pagination_class

alias of DefaultPagination

swh.deposit.api.private.deposit_read module

swh.deposit.api.private.deposit_read.aggregate_tarballs(extraction_dir, archive_paths)[source]
Aggregate multiple tarballs into one and returns this new archive’s
path.
Parameters:
  • extraction_dir (path) – Path to use for the tarballs computation
  • archive_paths ([str]) – Deposit’s archive paths
Returns:

Tuple (directory to clean up, archive path (aggregated or not))

class swh.deposit.api.private.deposit_read.SWHDepositReadArchives[source]

Bases: swh.deposit.api.common.SWHGetDepositAPI, swh.deposit.api.common.SWHPrivateAPIView, swh.deposit.api.private.DepositReadMixin

Dedicated class to read a deposit’s raw archives content.

Only GET is supported.

ADDITIONAL_CONFIG = {'extraction_dir': ('str', '/tmp/swh-deposit/archive/')}
process_get(req, collection_name, deposit_id)[source]
Build a unique tarball from the multiple received and stream that
content to the client.
Parameters:
  • req (Request) –
  • collection_name (str) – Collection owning the deposit
  • deposit_id (id) – Deposit concerned by the reading
Returns:

Tuple status, stream of content, content-type

class swh.deposit.api.private.deposit_read.SWHDepositReadMetadata[source]

Bases: swh.deposit.api.common.SWHGetDepositAPI, swh.deposit.api.common.SWHPrivateAPIView, swh.deposit.api.private.DepositReadMixin

Class in charge of aggregating metadata on a deposit.

ADDITIONAL_CONFIG = {'provider': ('dict', {'provider_type': 'deposit_client', 'metadata': {}}), 'tool': ('dict', {'version': '0.0.1', 'name': 'swh-deposit', 'configuration': {'sword_version': '2'}})}
metadata_read(deposit)[source]
Read and aggregate multiple data on deposit into one unified data
dictionary.
Parameters:deposit (Deposit) – Deposit concerned by the data aggregation.
Returns:Dictionary of data representing the deposit to inject in swh.
process_get(req, collection_name, deposit_id)[source]

Routine to deal with the deposit’s get processing.

Returns:Tuple status, stream of content, content-type

swh.deposit.api.private.deposit_update_status module

class swh.deposit.api.private.deposit_update_status.SWHUpdateStatusDeposit[source]

Bases: swh.deposit.api.common.SWHPutDepositAPI, swh.deposit.api.common.SWHPrivateAPIView

Deposit request class to update the deposit’s status.

HTTP verbs supported: PUT

parser_classes = (<class 'rest_framework.parsers.JSONParser'>,)
additional_checks(req, headers, collection_name, deposit_id=None)[source]

Enrich existing checks to the default ones.

New checks: - Ensure the status is provided - Ensure it exists

restrict_access(req, deposit=None)[source]

Remove restriction modification to ‘partial’ deposit. Update is possible regardless of the existing status.

process_put(req, headers, collection_name, deposit_id)[source]

Update the deposit’s status

Returns:204 No content

swh.deposit.api.private.urls module

Module contents

class swh.deposit.api.private.DepositReadMixin[source]

Bases: object

Deposit Read mixin