Project

Profile

Help

Story #2872

closed

As an authenticated user, I can create a Content unit from one or more artifacts

Added by dkliban@redhat.com almost 7 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
High
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 23
Quarter:

Description

For an API user to create a Content unit, Pulp 3 needs to have the following:

- the ContentArtifact "through" model[0] for Content and Artifact. It contains a ForeignKey field pointing to Artifact and another one pointing to Content. It also contains a relative path char field. All three are required and can not be null. The combination of 3 is a uniqueness constraint.
- the Content model with an artifacts ManyToManyField pointing to Artifact through ContentArtifact.
- viewset that can handle CRD operations for Content.
- serializer for the viewset which will return all serialized fields of the Content model including the artifacts.
- API endpoint at /api/v3/content/units/
- POST request to the /api/v3/content/units/ endpoint creates Content. The body of the request contains a dictionary that looks like the following:

{
    "artifacts": [{
        "< artifact >": "< relative_path >"
    }, {
        "< artifact2 >": "< relative_path2 >"
    }],
    "notes": {}
}

First a new Content instance is created with notes from the payload. Then the 'artifacts' from the payload are used to create ContentArtifact instances that reference the new Content.

- GET request to the /api/v3/content/units/<content unit id> returns serialized Content

- DELETE request to the /api/v3/content/units/<content unit id>/ raises an exception if the Artifact is still associated with any Repository. The exception should provide a list of Repositories still associated with the Artifact. If an exception is not raised, Artifact is removed from the database.

- PUT/PATCH requests to the /api/v3/content/units/<content unit id>/ raises an exception (409 unsupported method)

[0] https://docs.djangoproject.com/en/1.9/topics/db/models/#intermediary-manytomany


Related issues

Blocks Pulp - Task #2893: Add Publication and Distribution models.CLOSED - CURRENTRELEASEjortel@redhat.com

Actions
Blocks Pulp - Task #2942: Refit ChangeSet to work with content model changes.CLOSED - CURRENTRELEASEjortel@redhat.com

Actions

Also available in: Atom PDF