<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 1, 2019 at 5:37 PM Simon Baatz <<a href="mailto:gmbnomis@gmail.com" target="_blank">gmbnomis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Using the new SingleArtifactContentUploadSerializer I noticed two<br>
things that I would like to get feedback on:<br>
<br>
1. If a repo version is created (using the "repository" parameter),<br>
   "created_resources" of the respective task contains the content unit<br>
   and the new repo version, e.g.<br>
<br>
{<br>
    "_created": "2019-10-01T18:40:25.453340Z",<br>
    "_href": "/pulp/api/v3/tasks/9083f70c-7c28-4f76-8a78-a18b96c279de/",<br>
    "created_resources": [<br>
        "/pulp/api/v3/repositories/6891aeb6-756d-4bb5-baaf-5d523c6dc16c/versions/1/",<br>
        "/pulp/api/v3/content/cookbook/cookbooks/5a24108b-d763-4f7f-9eb7-a855e7355ac2/"<br>
    ],<br>
    "error": null,<br>
...<br>
<br>
   However, actually three resources may be created: artifact,<br>
   content unit and repo version.  Why is the repo version included,<br>
   but not the artifact (which seems to be included in<br>
   "reserved_resources_record")?<br></blockquote><div><br></div><div>Pulp typically doesn't report Artifacts being created except when the API call is to specifically create an Artifact. For example, sync creates a huge number of Artifacts, but  it don't report those. This isn't a very consistent behavior, but it avoids the practical issue of an overwhelming amount of Artifacts in some situations at least. Feedback on what would be better here would be great.</div><div><br></div><div>Beyond Artifacts, sometimes a single file generates multiple content units, e.g. moduleMD content, or in the future pulp_ansible collections creating multiple roles they contain. general_create currently record only 1 CreatedResource is my understanding and I filed a bug about that here:  <a href="https://pulp.plan.io/issues/5539">https://pulp.plan.io/issues/5539</a>  Feedback on which solution would be best would be good.<br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
2.  What is the best way for the caller to tell the created resources<br>
   apart?  Look at the URLs?  Look at data returned by a GET?  (but<br>
   there is no common type-like field for these resources).<br></blockquote><div><br></div><div>Yes inspecting the urls is the recommended way. It's a bit cumbersome because you can't use an equality operator to compare, versus something like <a href="https://github.com/apirobot/django-rest-polymorphic">django-rest-polymorphic</a>. A `startswith` should work well enough, or a `contains` in case of `/pulp/api/v3/` being re-rooted later.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
_______________________________________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/pulp-dev</a><br>
</blockquote></div></div>